コード例 #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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #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);
        }