Beispiel #1
0
            public void DisplayFizzBuzzReturnsViewModel()
            {
                // Arrange
                fizzBuzzViewModelCollection.InputNumber = 50;
                //Mockup function call in FizzBuzz Business logic
                fizzBuzzManager.Setup(FizzBuzzMock => FizzBuzzMock.Generate(It.IsAny <int>())).Returns(GetMockFizzBuzz(50));
                fizzBuzzController = new FizzBuzzController(fizzBuzzManager.Object);

                // Act
                var result = fizzBuzzController.DisplayFizzBuzz(fizzBuzzViewModelCollection) as ViewResult;

                fizzBuzzViewModelCollection = (FizzBuzzViewModel)result.Model;

                // Assert
                Assert.AreEqual("FizzBuzzViewModel", result.Model.GetType().Name);
                Assert.AreEqual(50, fizzBuzzViewModelCollection.DisplayList.Count);
                Assert.AreEqual("Display", result.ViewName);
            }