示例#1
0
        public void CreateCitySuccess_When_data_is_real()
        {
            // Arrange
            controller = new FavoriteCitiesController(unitOfWork);
            var city = new CityModel {
                Id = 5, Name = "Las Vegas"
            };

            // Act
            var result = controller.Create(city) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual("Index", result.RouteValues["action"]);
        }
示例#2
0
        public void CreateCitySuccess()
        {
            // Arrange
            controller = new FavoriteCitiesController(mockUnitOfWork.Object);
            var city = new CityModel {
                Id = 5, Name = "Las Vegas"
            };

            // Act
            var result = controller.Create(city) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual("Index", result.RouteValues["action"]);
            mockUnitOfWork.Verify(i => i.CityRepository.Create(It.IsAny <Database.Entities.City>()), Times.AtLeastOnce);
        }