static void Main(string[] args) { Calculator.Calculator c = new Calculator.Calculator(); int i = 5, j = 6; c.Swap(ref i, ref j); Console.WriteLine(i + " " + j); Console.Read(); Account acc1 = new Account(); acc1.Balance = 500; Account acc2 = new Account(); acc2.Balance = 300; AccountManager manager = new AccountManager(); manager.Transfer(acc1, acc2, 100); /* * Calculator.Calculator calculatorInstance = new TestApplication.Calculator.Calculator(); * calculatorInstance.Div(false, 2, 4096, "baba", "3", new Calculator.Calculator()); * //TestFalse(false); * //TestTrue(true); * Random r = new Random(); * for (int i = 0; i < 100; i++) * { * //Test(r.Next() % 2 == 0); * } * * MsContractsCalculator cc = new MsContractsCalculator(); * //cc.Div(DateTime.Now.Second, 2); * * * LinFuCalculator calculator = new LinFuCalculator(); * * * AdHocContract contract = new AdHocContract(); * // contract.Preconditions.Add(new LinFuCalculatorPC()); * contract.Postconditions.Add(new AccountPC()); * ProxyFactory factory = new ProxyFactory(); * * ContractChecker checker = new ContractChecker(contract); * checker.Target = new Account(); * * ICalculator wrapped = factory.CreateProxy<LinFuCalculator>(checker); * Account account = factory.CreateProxy<Account>(checker); * account.Deposit(200); * * * * * // Require.On(contract).ForMethodWith(t => t.Name == "Mult").That<int>(arg => arg != 0).OtherwisePrint("Error"); * * WrappedWorker worker = new WrappedWorker(new Worker()); * Worker wrappedWorker = factory.CreateProxy<Worker>(worker); * wrappedWorker.Do(); */ }
static void Main(string[] args) { Calculator.Calculator c = new Calculator.Calculator(); int i = 5, j = 6; c.Swap(ref i, ref j); Console.WriteLine(i + " " + j); Console.Read(); Account acc1 = new Account(); acc1.Balance = 500; Account acc2 = new Account(); acc2.Balance = 300; AccountManager manager = new AccountManager(); manager.Transfer(acc1, acc2, 100); /* Calculator.Calculator calculatorInstance = new TestApplication.Calculator.Calculator(); calculatorInstance.Div(false, 2, 4096, "baba", "3", new Calculator.Calculator()); //TestFalse(false); //TestTrue(true); Random r = new Random(); for (int i = 0; i < 100; i++) { //Test(r.Next() % 2 == 0); } MsContractsCalculator cc = new MsContractsCalculator(); //cc.Div(DateTime.Now.Second, 2); LinFuCalculator calculator = new LinFuCalculator(); AdHocContract contract = new AdHocContract(); // contract.Preconditions.Add(new LinFuCalculatorPC()); contract.Postconditions.Add(new AccountPC()); ProxyFactory factory = new ProxyFactory(); ContractChecker checker = new ContractChecker(contract); checker.Target = new Account(); ICalculator wrapped = factory.CreateProxy<LinFuCalculator>(checker); Account account = factory.CreateProxy<Account>(checker); account.Deposit(200); // Require.On(contract).ForMethodWith(t => t.Name == "Mult").That<int>(arg => arg != 0).OtherwisePrint("Error"); WrappedWorker worker = new WrappedWorker(new Worker()); Worker wrappedWorker = factory.CreateProxy<Worker>(worker); wrappedWorker.Do(); */ }
public Calculator TestMe() { Calculator c = new Calculator(); c.test.member = 10; return c; }
public int Div(bool t, int divided, int divisor, string val, string delta, Calculator c) { if (divided > 0) //Div(t, --divided, divisor,val, delta,c); val = "barabara"; c.test.member = 3; return 0; }