Example #1
0
        public void ProxyDistributorModule_TransactionDestination_CreateTransAndGetDestination()
        {
            var model   = new DistributorSystemModel();
            var server1 = new ServerId("localhost", 1);
            var server2 = new ServerId("localhost", 2);

            model.AddServer(server1);
            model.AddServer(server2);

            const string hash = "123";

            var res1 = model.CreateTransaction(hash);

            Assert.IsNotNull(res1);
            var res2 = model.GetDestination(res1.UserTransaction);

            Assert.IsTrue(server1.Equals(res2));

            var res3 = model.CreateTransaction(hash);

            Assert.IsNotNull(res3);
            var res4 = model.GetDestination(res3.UserTransaction);

            Assert.IsTrue(server2.Equals(res4));

            model.ServerNotAvailable(server1);

            var res5 = model.CreateTransaction(hash);

            Assert.IsNotNull(res5);
            var res6 = model.GetDestination(res5.UserTransaction);

            Assert.IsTrue(server2.Equals(res6));

            model.ServerNotAvailable(server2);

            var res7 = model.CreateTransaction(hash);

            Assert.AreEqual(Errors.NotAvailableServersInSystem + "; ", res7.ErrorDescription);
        }
Example #2
0
 private void ServerNotAvailableInner(ServerId server)
 {
     _distributorSystemModel.ServerNotAvailable(server);
 }