Exemplo n.º 1
0
        public void validateNames_EmptytringInAListOf2Strings_Returnsfalse()
        {
            var namesRepositoryMock = new Mock <IDataReaderWriter>();

            namesRepositoryMock.Setup(x => x.RetrieveNames())
            .Returns(new List <string> {
                "Janet Parsons",
                "",
            });

            var loggerMock = new Mock <ILoggerService>();
            INameSorterService objNameSorterService = new NameSorterService(namesRepositoryMock.Object, loggerMock.Object);
            string             illegalName;
            var result = objNameSorterService.validateNames(out illegalName);

            Assert.IsTrue(illegalName == string.Empty);
            Assert.IsFalse(result);
        }
Exemplo n.º 2
0
        public void validateNames_ANameHavingMoreThan3GivenNamesInAListOf2Strings_Returnsfalse()
        {
            var namesRepositoryMock = new Mock <IDataReaderWriter>();

            namesRepositoryMock.Setup(x => x.RetrieveNames())
            .Returns(new List <string> {
                "Janet Parsons",
                "Janet Parsons jackson brown whittle",
            });

            var loggerMock = new Mock <ILoggerService>();
            INameSorterService objNameSorterService = new NameSorterService(namesRepositoryMock.Object, loggerMock.Object);
            string             illegalName;
            var result = objNameSorterService.validateNames(out illegalName);

            Assert.AreEqual(illegalName, "Janet Parsons jackson brown whittle");
            Assert.IsFalse(result);
        }
Exemplo n.º 3
0
        public void validateNames_ValidListOf2Strings_ReturnsTrue()
        {
            var namesRepositoryMock = new Mock <IDataReaderWriter>();

            namesRepositoryMock.Setup(x => x.RetrieveNames())
            .Returns(new List <string> {
                "Janet",
                "Adonis Julius Archer sainsbury",
            });


            var loggerMock = new Mock <ILoggerService>();
            INameSorterService objNameSorterService = new NameSorterService(namesRepositoryMock.Object, loggerMock.Object);
            string             illegalName;
            var result = objNameSorterService.validateNames(out illegalName);

            Assert.IsNull(illegalName);
            Assert.IsTrue(result);
        }