Ejemplo n.º 1
0
        public void Given_No_Strings_In_File_returns_Empty_Results()
        {
            //Arrange
            var mockedFileService = new Mock <IFileservice>();

            mockedFileService.Setup(x => x.Read(It.IsAny <string>())).Returns(new string[0]);
            var validationService = new ValidationService();
            //Act
            var service = new DictionaryService(mockedFileService.Object, validationService);
            var result  = service.CreateResult(It.IsAny <string>(), "Spin", "Spot", It.IsAny <string>());

            //Assert
            result.Count.Should().Be(0);
        }
Ejemplo n.º 2
0
        public void Given_StartWord_Spin_EndWord_Spot_Add_Word_Has_More_Than_One_Char_Different_Returns_Spin_Spit_Spot()
        {
            //Arrange
            var mockedFileService = new Mock <IFileservice>();

            mockedFileService.Setup(x => x.Read(It.IsAny <string>())).Returns(CreateSUTMoreThanOneCharacterDifference());
            var validationService = new ValidationService();
            //Act
            var service = new DictionaryService(mockedFileService.Object, validationService);
            var result  = service.CreateResult(It.IsAny <string>(), "Spin", "Spot", It.IsAny <string>());

            //Assert
            result.Should().Equal(new List <string>()
            {
                "Spin",
                "Spit",
                "Spot"
            });
        }
Ejemplo n.º 3
0
        public void Given_StartWord_Spin_EndWord_Spot_Add_Word_Not_In_File_Returns_Spin_Spit_Spot()
        {
            //Arrange
            var mockedFileService = new Mock <IFileservice>();

            mockedFileService.Setup(x => x.Read(It.IsAny <string>())).Returns(CreateSUTDuplicatedData());
            var validationService = new ValidationService();
            //Act
            var service = new DictionaryService(mockedFileService.Object, validationService);
            var result  = service.CreateResult(It.IsAny <string>(), "Spin", "Spot", It.IsAny <string>());

            //Assert
            result.Should().Equal(new List <string>()
            {
                "Spin",
                "Spit",
                "Spot"
            });
        }