예제 #1
0
        private async Task <ApiProductInventoryResponseModel> CreateRecord()
        {
            var model = new ApiProductInventoryRequestModel();

            model.SetProperties(2, 2, DateTime.Parse("1/1/1988 12:00:00 AM"), 2, Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B");
            CreateResponse <ApiProductInventoryResponseModel> result = await this.Client.ProductInventoryCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapModelToBO()
        {
            var mapper = new BOLProductInventoryMapper();
            ApiProductInventoryRequestModel model = new ApiProductInventoryRequestModel();

            model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A");
            BOProductInventory response = mapper.MapModelToBO(1, model);

            response.Bin.Should().Be(1);
            response.LocationID.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Quantity.Should().Be(1);
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Shelf.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiProductInventoryModelMapper();
            var model  = new ApiProductInventoryRequestModel();

            model.SetProperties(1, 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A");

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

            patch.ApplyTo(response);
            response.Bin.Should().Be(1);
            response.LocationID.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Quantity.Should().Be(1);
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Shelf.Should().Be("A");
        }