public async Task TestGetProductsAsync()
        {
            // Arrange
            var repository = RepositoryMocker.GetAdventureWorksRepository();
            var controller = new ProductionController(repository, null);

            // Act
            var response = await controller.GetProductsAsync() as ObjectResult;

            var value = response.Value as IListModelResponse <ProductViewModel>;

            controller.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
        public async Task TestGetNonExistingProductAsync()
        {
            // Arrange
            var repository = RepositoryMocker.GetAdventureWorksRepository();
            var controller = new ProductionController(repository);
            var id         = 0;

            // Act
            var response = await controller.GetProductAsync(id) as ObjectResult;

            var value = response.Value as ISingleModelResponse <ProductViewModel>;

            repository.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
        public async Task TestPostProductAsync()
        {
            // Arrange
            var repository = RepositoryMocker.GetAdventureWorksRepository();
            var controller = new ProductionController(repository, null);
            var request    = new ProductViewModel
            {
                ProductName   = String.Format("New test product {0}{1}{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond),
                ProductNumber = String.Format("{0}{1}{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond)
            };

            // Act
            var response = await controller.PostProductAsync(request) as ObjectResult;

            var value = response.Value as ISingleModelResponse <ProductViewModel>;

            repository.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
        public async Task TestPutProductAsync()
        {
            // Arrange
            var repository = RepositoryMocker.GetAdventureWorksRepository();
            var controller = new ProductionController(repository, null);
            var id         = 1;
            var request    = new ProductViewModel
            {
                ProductID     = id,
                ProductName   = "New product test II",
                ProductNumber = "XYZ"
            };

            // Act
            var response = await controller.UpdateProductAsync(id, request) as ObjectResult;

            var value = response.Value as ISingleModelResponse <ProductViewModel>;

            repository.Dispose();

            // Assert
            Assert.False(value.DidError);
        }