public async Task ShouldReturnRangeException() { //Arrange var start = 101; var fizzBuzzService = new FizzBuzzService.Services.FizzBuzzService(); var controller = new FizzBuzzController(fizzBuzzService); //Act var result = await controller.GetAsync(start); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult)); }
public async Task ShouldReturnCorrectFizzBuzz() { //Arrange var start = 0; var fizzBuzzService = new FizzBuzzService.Services.FizzBuzzService(); var controller = new FizzBuzzController(fizzBuzzService); //Act var result = await controller.GetAsync(start) as OkNegotiatedContentResult <List <string> >; //Assert Assert.IsNotNull(result); Assert.AreEqual(result.Content.Count, 100); }
public async Task ShouldCreateFile() { //Arrange DeleteContentDirectory(); var start = 0; var fizzBuzzService = new FizzBuzzService.Services.FizzBuzzService(); var controller = new FizzBuzzController(fizzBuzzService); //Act var result = await controller.GetAsync(start) as OkNegotiatedContentResult <List <string> >; //Assert //Assert.AreEqual(result.Content.Count, 100); //Assert Assert.IsNotNull(result); Assert.AreEqual(new DirectoryInfo(@"C:\FizzBuzz\Persist\").GetFiles().Length, 1); }
public void ShouldReturnCorrectHundredTimesFizzBuzz() { //Arrange var start = 0; var fizzBuzzService = new FizzBuzzService.Services.FizzBuzzService(); var controller = new FizzBuzzController(fizzBuzzService); var TaskList = new List <Task <IHttpActionResult> >(); //Act for (var i = 0; i < 100; i++) { var result = controller.GetAsync(start); TaskList.Add(result); } Task.WaitAll(TaskList.ToArray()); //Assert TaskList.ForEach(o => Assert.AreEqual( ((OkNegotiatedContentResult <List <string> >)o.Result).Content.Count , 100)); }