Beispiel #1
0
        public async Task GetImage_ReturnsImage()
        {
            // Arrange
            var client       = _factory.CreateClient();
            var northwindApi = new NorthwindAPI(client, true);

            // Act
            var response = await northwindApi.ImageAsync(InMemoryDbEntitiesValues.TestSeafoodCategoryId);

            // Arrange
            response.Should().NotBeNull();
        }
        public async Task DeleteProduct_ReturnsExactEntities()
        {
            // Arrange
            var client       = _factory.CreateClient();
            var northwindApi = new NorthwindAPI(client, true);

            // Act
            var response = await northwindApi.DeleteProductByIdWithHttpMessagesAsync(InMemoryDbEntitiesValues.TestTofuProductId);

            // Arrange
            response.Should().NotBeNull();
            response.Response.IsSuccessStatusCode.Should().BeTrue();
        }
        public async Task UpdateProduct_ReturnsExactEntities()
        {
            // Arrange
            var client       = _factory.CreateClient();
            var northwindApi = new NorthwindAPI(client, true);

            // Act
            var response = await northwindApi.UpdateProductWithHttpMessagesAsync(FakeProductEditModel());

            // Arrange
            response.Should().NotBeNull();
            response.Response.IsSuccessStatusCode.Should().BeTrue();
        }
        public async Task CreateProduct_ReturnsExactEntities()
        {
            // Arrange
            var client       = _factory.CreateClient();
            var northwindApi = new NorthwindAPI(client, true);

            // Act
            var response = await northwindApi.CreateProductAsync(FakeProductEditModel());

            // Arrange
            response.Should().NotBeNull();
            response.As <ProductModel>().ProductName.Should().Be(InMemoryDbEntitiesValues.TestTofuProductName);
        }
        public async Task GetProductById_ReturnsExactEntities()
        {
            // Arrange
            var client          = _factory.CreateClient();
            var northwindApi    = new NorthwindAPI(client, true);
            var expectedProduct = FakeProductModels().First(product => product.ProductId == InMemoryDbEntitiesValues.TestChangProductId);

            // Act
            var response = await northwindApi.GetProductByIdAsync(InMemoryDbEntitiesValues.TestChangProductId);

            // Arrange
            response.Should().NotBeNull();
            response.Should().BeEquivalentTo(expectedProduct);
        }
Beispiel #6
0
        public async Task GetCategories_ReturnsExactEntities()
        {
            // Arrange
            var client             = _factory.CreateClient();
            var northwindApi       = new NorthwindAPI(client, true);
            var expectedCategories = FakeCategoryModels();

            // Act
            var response = await northwindApi.GetCategoriesAsync();

            // Arrange
            response.Should().NotBeNull();
            response.Should().HaveCount(2);
            response.Should().BeEquivalentTo(expectedCategories);
        }