public async void ShouldSaveNewTicket() { var guestName = Guid.NewGuid().ToString(); var guestPhone = "555-555-5555"; var guestAddress = "12345 Somewhere USA"; MockConsoleWrapper.SetupSequence(x => x.ReadLineAsync()) .ReturnsAsync(guestName) .ReturnsAsync(guestPhone) .ReturnsAsync(guestAddress); IDictionary <string, string> actualConvertInputToModelArgument = null; MockConverter.Setup(x => x.ConvertInputToModel(It.IsAny <IDictionary <string, string> >())) .Callback <IDictionary <string, string> >(x => actualConvertInputToModelArgument = x); await Screen.Activated(); var expectedConvertInputToModelArgument = new Dictionary <string, string> { { "Field 1", guestName }, { "Field 2", guestPhone }, { "Field 3", guestAddress } }; Assert.Equal(expectedConvertInputToModelArgument, actualConvertInputToModelArgument); }
public async void ShouldWaitForInputAtEachLineRendered() { MockConsoleWrapper.Setup(x => x.ReadLineAsync()).ReturnsAsync("abc"); await Screen.Activated(); for (var lineNumber = 0; lineNumber < DisplayNames.Count(); lineNumber++) { var topPosition = lineNumber; MockConsoleWrapper.Verify(x => x.SetCursorPosition(32, topPosition)); MockConsoleWrapper.Verify(x => x.ReadLineAsync()); } }