Beispiel #1
0
        public void AddRangeTest()
        {
            // Arrange
            var mock       = new Mock <IProductRepository>();
            var controller = new ProductController(mock.Object);
            // Act
            var result = controller.AddRange(new List <WebApi.ViewModels.Product>()
            {
                new WebApi.ViewModels.Product()
                {
                    Id = 1, Name = "Product #1", CategoryId = 1, Description = "Product #1 Description", Price = 11, Quantity = 111
                },
                new WebApi.ViewModels.Product()
                {
                    Id = 2, Name = "Product #2", CategoryId = 2, Description = "Product #2 Description", Price = 22, Quantity = 222
                }
            }).Result as OkResult;

            // Assert
            Assert.NotNull(result);
            Assert.AreEqual(StatusCodes.Status200OK, result.StatusCode);
        }