示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }