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); }
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); }
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); }
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))); }