Ejemplo n.º 1
0
        public void ShouldGetAPersonList()
        {
            //Arrange
            //Todo: How to fix person dependency in order to get random profile images and lorem ipsum text of names ?
            PersonEngine     personEngine = new PersonEngine();
            ImageEngine      imageEngine  = new ImageEngine(new LoremPixelProvider());
            LoremIpsumEngine textEngine   = new LoremIpsumEngine(new PersonNamesProvider());

            string[] text = textEngine.Create(1).AsParagraph().Split(' ');


            //Act
            List <Person> personList = personEngine.Create(1);

            //Assert

            List <Person> testList = new List <Person> {
                new Person {
                    FirstName = text[0], LastName = text[1], Image = imageEngine.Create()
                }
            };


            Assert.AreEqual(testList, personList);
        }
Ejemplo n.º 2
0
        public void ShouldReturnADefaultDictionaryText()
        {
            int expectedWords = 1000;

            LoremIpsumEngine loremIpsum = new LoremIpsumEngine(new LoremIpsumTextProvider());
            //Action
            LoremIpsumText text = loremIpsum.Create(expectedWords);

            //Assert
            Assert.AreEqual(text.Words.Count, expectedWords);
        }
Ejemplo n.º 3
0
        public void ShouldUseALoremIpsumTextDictionary()
        {
            //Arrange
            int expectedWords = 1000;

            _dictonaryMock.Setup(x => x.GetText(expectedWords)).Returns(new List <string>());
            LoremIpsumEngine loremIpsum = new LoremIpsumEngine(_dictonaryMock.Object);

            //Action
            loremIpsum.Create(expectedWords);
            //Assert
            _dictonaryMock.Verify(i => i.GetText(expectedWords));
        }
Ejemplo n.º 4
0
        public void ShouldCreateALoremIpsumText()
        {
            //Arrange
            int expectedWords = 1;

            _dictonaryMock.Setup(x => x.GetText(expectedWords)).Returns(new List <string> {
                "hello"
            });
            LoremIpsumEngine loremIpsum = new LoremIpsumEngine(_dictonaryMock.Object);
            //Action
            LoremIpsumText text = loremIpsum.Create(expectedWords);

            //Assert
            Assert.AreEqual(expectedWords, text.Words.Count);
        }
Ejemplo n.º 5
0
        public void ShouldGetBillGatesName()
        {
            //Arrange
            string expectedName  = "bill gates";
            int    expectedWords = 1;
            Mock <ILoremIpsumTextDictionary> providerMock = new Mock <ILoremIpsumTextDictionary>();

            providerMock.Setup(x => x.GetText(expectedWords)).Returns(new List <string>()
            {
                expectedName
            });
            //Act
            LoremIpsumEngine engine = new LoremIpsumEngine(providerMock.Object);
            LoremIpsumText   name   = engine.Create(expectedWords);

            //Assert
            Assert.AreEqual(expectedName, name.AsParagraph());
        }