Exemplo n.º 1
0
        public void StarTrekIpsumShouldReturnRandomString()
        {
            // Arrange
            var starTrekIpsumGenerator = new StarTrekIpsumGenerator(_blobStorageClient);
            var text = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, $@"Resources\StarTrek_{StarTrekCaptain.Picard}.txt"));

            _blobStorageClient.GetStarTrekText(Arg.Any <StarTrekCaptain>()).Returns(text);

            // Act
            var result = starTrekIpsumGenerator.ParagraphGenerator();

            // Assert
            Assert.IsNotNull(result);
        }
Exemplo n.º 2
0
        public void StarTrekIpsumShouldReturnCorrectText()
        {
            // Arrange
            var captain = StarTrekCaptain.Kirk;
            var text    = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, $@"Resources\StarTrek_{captain}.txt"));

            _blobStorageClient.GetStarTrekText(Arg.Any <StarTrekCaptain>()).Returns(text);

            var starTrekIpsumGenerator = new StarTrekIpsumGenerator(_blobStorageClient);

            // Act
            var result = starTrekIpsumGenerator.ParagraphGenerator(1, captain).Result;

            //  Assert
            var resultArray = Regex.Split(result, @"(?<=[\.!\?])\s+").ToList();

            resultArray.ForEach(x => Assert.IsTrue(text.Contains(x)));
        }