public void Handle_NameAndText_PromptAndReceive() { var handler = new AddItemHandler(new AddItemOptions(OptionsDefaultName, "SomeText"), "AdditemHandler"); handler.Handle(); AssertFileCreatedAtCorrectLocation(); }
public void Handle_NameAndTextNotInput_ReceiveThem() { using (StartMockedConsole()) { var handler = new AddItemHandler(new AddItemOptions(string.Empty, string.Empty),"AddItemHandler"); _console.Setup(x => x.ReadLine()).ReturnsInOrder( OptionsDefaultName, OptionsTextName); handler.Handle(); Assert.That(handler.Options.Name,Is.EqualTo(OptionsDefaultName)); Assert.That(handler.Options.Text, Is.EqualTo(OptionsTextName)); AssertFileCreatedAtCorrectLocation(); _console.Verify(x => x.WriteLine(Resources.Resources.AddItemHandler_AddName)); _console.Verify(x => x.WriteLine(Resources.Resources.AddItemHandler_AddText)); _console.Verify(x => x.WriteLine(Resources.Resources.AddItemHandler_ShortcutCreated)); } }