예제 #1
0
        public async Task View_CallAskForActivity_noInput()
        {
            AutoResetEvent _eventIsCalled = new AutoResetEvent(false);
            var            sut            = new ViewCLI();

            sut.CLI                   = new CommandLineInterfaceFake();
            sut.TimeToAnswer          = TimeSpan.FromMilliseconds(250);
            sut.RaiseNoActivityEvent += (sender, e) => _eventIsCalled.Set();
            sut.AskForActivity(DateTime.Now, "");
            var wasEventCalled = _eventIsCalled.WaitOne(300);

            Assert.True(wasEventCalled);
        }
예제 #2
0
        public async Task View_CallAskForActivity_WithInput()
        {
            string receivedActivity = string.Empty;
            var    sut = new ViewCLI();

            sut.TimeToAnswer = TimeSpan.FromMilliseconds(500);
            sut.CLI          = new CommandLineInterfaceFake();
            AutoResetEvent _eventIsCalled = new AutoResetEvent(false);

            sut.RaiseActivityAddedEvent += (sender, e) => {
                receivedActivity = e.Description;
                _eventIsCalled.Set();
            };

            string expectedActivity = "last Activity";

            sut.AskForActivity(DateTime.Now, expectedActivity);
            Assert.Equal(expectedActivity, receivedActivity);
        }