public void IndexGetWithValuesReturnsView() { var controller = new HomeController(); var result = controller.Index(1, 100) as ViewResult; AssertValidFizzBuzzViewResult(result); }
public void IndexGetHasEmptyResults() { var controller = new HomeController(); var result = controller.Index(12, 42) as ViewResult; var viewModel = result.Model as FizzBuzzModel; Assert.That(viewModel.Results, Is.Not.Null); Assert.That(viewModel.Results.Count, Is.EqualTo(0)); }
public void IndexGetEchoesNonDefaultFirstAndLast() { var controller = new HomeController(); var result = controller.Index(12, 47) as ViewResult; var viewModel = result.Model as FizzBuzzModel; Assert.That(viewModel.First, Is.EqualTo(12)); Assert.That(viewModel.Last, Is.EqualTo(47)); }
public void IndexPostEchoesFirstAndLast() { var postData = new FizzBuzzPostModel { First = 1, Last = 15 }; var controller = new HomeController(); var result = controller.Index(postData) as ViewResult; var viewModel = result.Model as FizzBuzzModel; Assert.That(viewModel.First, Is.EqualTo(1)); Assert.That(viewModel.Last, Is.EqualTo(15)); }
public void IndexPostReturnsStrings(int index, string expected) { var postData = new FizzBuzzPostModel { First = 1, Last = 15 }; var controller = new HomeController(); var result = controller.Index(postData) as ViewResult; var viewModel = result.Model as FizzBuzzModel; Assert.That(viewModel.Results.Count, Is.EqualTo(15)); Assert.That(viewModel.Results[index - 1], Is.EqualTo(expected)); }
public void IndexPostReturnsViewWithOneToFifteen() { var postData = new FizzBuzzPostModel { First = 1, Last = 15 }; var controller = new HomeController(); var result = controller.Index(postData) as ViewResult; AssertValidFizzBuzzViewResult(result); }
public void IndexPostReturnsViewWithDefaultPostData() { var controller = new HomeController(); var result = controller.Index(new FizzBuzzPostModel()) as ViewResult; AssertValidFizzBuzzViewResult(result); }