public void Index() { // Arrange var mock = new Mock <IFizzBuzzService>(); var list = new List <FizzBuzz>() { new FizzBuzz { Color = "Red", Text = "dupa" }, new FizzBuzz { Color = "blue", Text = "dupa2" } }; mock.Setup(x => x.GetList()).Returns(list); var controller = new FizzBuzzController(mock.Object); // Act ViewResult result = controller.Index() as ViewResult; var listTest = (BuzzViewModel)result.ViewData.Model; // Assert Assert.IsNotNull(result); CollectionAssert.Equals(listTest, list); }
public void Given15ReturnFizzBuzz() { FizzBuzzController controller = new FizzBuzzController(); ViewResult result = controller.Index(15) as ViewResult; string expected = "1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz "; string actual = result.ViewBag.Output; Assert.AreEqual(expected, actual); }
public void Given1Return1() { FizzBuzzController controller = new FizzBuzzController(); ViewResult result = controller.Index(1) as ViewResult; string expected = "1 "; string actual = result.ViewBag.Output; Assert.AreEqual(expected, actual); }
public void Given5Return12Fizz4Buzz() { FizzBuzzController fbc = new FizzBuzzController(); ViewResult result = fbc.Index(5) as ViewResult; String expected = "1 2 Fizz 4 Buzz "; String actual = result.ViewBag.Output; Assert.AreEqual(expected, actual); }
public void WhenUserRequestedForHomePageIndexViewShouldBeReturned() { //Act ViewResult viewResult = fizzBuzzController.Index() as ViewResult; var model = viewResult?.Model as FizzBuzzViewModel; //Assert Assert.AreEqual(model?.UserInput, 0); }
public void Dikirim15Diterima12Fizz4Buzz6Dst() { // Arange FizzBuzzController controller = new FizzBuzzController(); // Act ViewResult sut = controller.Index(15) as ViewResult; // sut - system under test string expected = "12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz"; string actual = sut.ViewBag.OutPut; // Assert Assert.AreEqual(expected, actual); }
public void Dikirim3Diterima12Fizz() { // Arange FizzBuzzController controller = new FizzBuzzController(); // Act ViewResult result = controller.Index(3) as ViewResult; string expected = "12Fizz"; string actual = result.ViewBag.OutPut; // Assert Assert.AreEqual(expected, actual); }
public void Given5Return12Fizz4Buzz() { // Arrange FizzBuzzController controller = new FizzBuzzController(); // Act ViewResult result = controller.Index(5) as ViewResult; // Assert string expected = "1 2 Fizz 4 Buzz "; string actual = result.ViewBag.Output; Assert.AreEqual(expected, actual); }