Ejemplo n.º 1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiShoppingCartItemModelMapper mapper = new ApiShoppingCartItemModelMapper();

            UpdateResponse <ApiShoppingCartItemResponseModel> updateResponse = await this.Client.ShoppingCartItemUpdateAsync(model.ShoppingCartItemID, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();

            await this.Cleanup();
        }
Ejemplo n.º 2
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiShoppingCartItemModelMapper();
            var model  = new ApiShoppingCartItemResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, "A");
            ApiShoppingCartItemRequestModel response = mapper.MapResponseToRequest(model);

            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ProductID.Should().Be(1);
            response.Quantity.Should().Be(1);
            response.ShoppingCartID.Should().Be("A");
        }
Ejemplo n.º 3
0
        public void CreatePatch()
        {
            var mapper = new ApiShoppingCartItemModelMapper();
            var model  = new ApiShoppingCartItemRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, "A");

            JsonPatchDocument <ApiShoppingCartItemRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiShoppingCartItemRequestModel();

            patch.ApplyTo(response);
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ProductID.Should().Be(1);
            response.Quantity.Should().Be(1);
            response.ShoppingCartID.Should().Be("A");
        }
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiShoppingCartItemResponseModel model = await client.ShoppingCartItemGetAsync(1);

            ApiShoppingCartItemModelMapper mapper = new ApiShoppingCartItemModelMapper();

            UpdateResponse <ApiShoppingCartItemResponseModel> updateResponse = await client.ShoppingCartItemUpdateAsync(model.ShoppingCartItemID, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }