Пример #1
0
        public async Task ProtocolHandlerPerformanceTest()
        {
            var data = ProtocolHandler;

            var a = TimestampFactory.Timestamp;

            Debug.WriteLine(TimestampFactory.Timestamp);

            for (int i = 0; i < 10000; i++)
            {
                data.OnCommandReceived(this, CommandsTestObjects.GetProperTestCommand_confirmation("id" + i));
                //data.AddICommand(CommandsTestObjects.GetProperTestCommand_order("id" + i));
            }

            Debug.WriteLine(TimestampFactory.Timestamp);
            Debug.WriteLine(TimestampFactory.Timestamp.Difference(a));
            var ll = new List <Task <bool> >();

            for (int i = 0; i < 1000; i++)
            {
                if (i % 50 == 0)
                {
                    ll.Add(ProtocolHandler.Order().WasConfirmedInTimeAsync(ProtocolTestObjects.GetNormalOrder("id" + i)));
                }
            }

            await Task.WhenAll(ll);

            Debug.WriteLine(TimestampFactory.Timestamp);
            Debug.WriteLine(TimestampFactory.Timestamp.Difference(a));
            Debug.WriteLine("end");
        }
 public void Setup()
 {
     Dispatch           = ResponseAwaiterDispatchTestObjects.GetProperResponseAwaiterDispatch();
     NormalOrder        = ProtocolTestObjects.GetNormalOrder();
     NormalConfirmation = ProtocolTestObjects.GetNormalConfirmation();
     NormalReply        = ProtocolTestObjects.GetNormalReply();
 }
Пример #3
0
        public async Task Should_return_confirmation_when_proper_Reply_was_sent()
        {
            var testReply = ProtocolTestObjects.GetNormalReply();
            var result    = await ProtocolHandler.SendAsync(testReply);

            var confirmation = ProtocolHandler.Retrieve().ConfirmationOf(testReply);

            Assert.True(result);
            Assert.IsType <Confirmation>(confirmation);
            Assert.Equal(testReply.ID, confirmation.Confirms);
        }
Пример #4
0
        public async Task Should_return_true_when_proper_Confirmation_was_sent()
        {
            bool result = await ProtocolHandler.SendAsync(ProtocolTestObjects.GetNormalConfirmation());

            Assert.True(result);
        }