Exemple #1
0
        public async Task RunIntegrationTest()
        {
            // Arrange
            var starTrekIpsumGenerator = new StarTrekIpsumGenerator(_blobStorageClient);

            // Act
            var result = await starTrekIpsumGenerator.MultiParagraphGenerator(5, StarTrekCaptain.Picard);

            // Assert
            Assert.AreEqual(5, result.Length);
        }
Exemple #2
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);
        }
Exemple #3
0
        public void StarTrekIpsumShouldReturnMultipleParagraphs()
        {
            // Arrange
            var starTrekIpsumGenerator = new StarTrekIpsumGenerator(_blobStorageClient);
            var captain = StarTrekCaptain.Picard;
            var text    = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, $@"Resources\StarTrek_{captain}.txt"));

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

            // Act
            var result = starTrekIpsumGenerator.MultiParagraphGenerator(5).Result;

            // Assert
            Assert.AreEqual(5, result.Length);
            Assert.IsNotNull(result);
        }
Exemple #4
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)));
        }