Пример #1
0
		public void PrimitiveAsk(){
			var A = new FuncContractA ();
			var B = new FuncContractB ();
            Tools.ConnectContractsDirectly(A, B);

			var twiceI = A.Twice (i);
			if (twiceI != i * 2)
				throw new Exception ("Primitive ask failed");

			var toiletCopy = A.Copy (tt.First());
			if(!toiletCopy.IsEqual(tt.First()))
				throw new Exception ("Primitive ask failed");
		}
Пример #2
0
		public void ComplexAsk(){
			var A = new FuncContractA ();
			var B = new FuncContractB ();
            Tools.ConnectContractsDirectly(A, B);

			var dArr1 = Enumerable.Range (0, 100).Select(ii=>Convert.ToDouble(ii)).ToArray ();
			var dArr2 = Enumerable.Range (100, 200).Select(ii=>Convert.ToDouble(ii)).ToArray ();

			var summ = dArr1.Sum () + dArr2.Sum ();
			var res = A.SummOf2Arrays (dArr1, dArr2);
			if(summ!=res)
				throw new Exception ("Complex ask failed");

			var conc = A.ToArray (strArr [0], strArr [1], strArr[2]);

			if(!strArr.SequenceEqual(conc))
				throw new Exception ("Primitive ask failed");
				
			var strArr1 = dArr1.Select(a=>a.ToString()).ToArray ();
			var strArr2 = dArr2.Select(a=>a.ToString()).ToArray ();

			var sconc = string.Concat (strArr1.Concat (strArr2).ToArray ());

			if(A.Concat2Arrays(strArr1,strArr2).CompareTo(sconc)!=0)
				throw new Exception ("Primitive ask failed");
		
		}