public void NewStrategy_Should_ImplementICommandOfObjectModel() { // Arrange var factoryMock = new Mock <ICommandFactory <NewStrategy> >(); // Act var objectUnderTest = new NewStrategy(factoryMock.Object); // Assert Assert.IsInstanceOf <ICommand <ObjectModel> >(objectUnderTest); }
public void ShouldReturnCommandName() { // Arrange var factoryMock = new Mock <ICommandFactory <NewStrategy> >(); var newStrategy = new NewStrategy(factoryMock.Object); // Act var commandName = newStrategy.Name; // Assert Assert.AreEqual(commandName, Constants.CommandName.New); }
public void ShouldReturnEmptyHelpText() { // Arrange var factoryMock = new Mock <ICommandFactory <NewStrategy> >(); var newStrategy = new NewStrategy(factoryMock.Object); // Act var helpText = newStrategy.GetHelpText(); // Assert Assert.AreEqual(helpText, Resources.text.help.HelpTextValues.NewCommand); }
public void NewStrategy_Should_ExecuteChildCommand([ValueSource(nameof(Data))] NewStrategyFixture data) { // Arrange var commandMock = new Mock <ICommand <NewStrategy> >(); commandMock.Setup(x => x.Execute(It.IsAny <IEnumerable <string> >())).Returns(new CommandResult(true, new MessageLines { { data.Result, string.Empty } })); var factoryMock = new Mock <ICommandFactory <NewStrategy> >(); factoryMock.Setup(x => x.GetCommand(data.Input.FirstOrDefault())).Returns(commandMock.Object); var objectUnderTest = new NewStrategy(factoryMock.Object); // Act var result = objectUnderTest.Execute(data.Input); // Assert Assert.IsTrue(result.Success); Assert.AreEqual(data.Result, result.OutputMessages.First().Key); }