public void Execute_MessageContainsNoFamilies_WhenNoFamiliesInDatabase() { var dataFactoryMock = new Mock <IDataFactory>(); var command = new ListFamiliesCommand(dataFactoryMock.Object); dataFactoryMock.Setup(d => d.GetAllFamilies()).Returns(new List <Family>()); var result = command.Execute(new List <string>()); StringAssert.Contains("no families", result); }
public void Execute_MessageContainsName_WhenFamiliesExistInDatabase() { var dataFactoryMock = new Mock <IDataFactory>(); var fakeFamilies = new List <Family>() { new Family(), new Family() }; var command = new ListFamiliesCommand(dataFactoryMock.Object); dataFactoryMock.Setup(d => d.GetAllFamilies()).Returns(fakeFamilies); var result = command.Execute(new List <string>()); StringAssert.Contains("Name", result); }
public void Execute_CallsDataGetAllFamilies() { var dataFactoryMock = new Mock <IDataFactory>(); var fakeFamilies = new List <Family>() { new Family(), new Family() }; var command = new ListFamiliesCommand(dataFactoryMock.Object); dataFactoryMock.Setup(d => d.GetAllFamilies()).Returns(fakeFamilies); command.Execute(new List <string>()); dataFactoryMock.Verify(d => d.GetAllFamilies(), Times.Once); }