コード例 #1
0
        private async Task <ApiSpecialOfferResponseModel> CreateRecord()
        {
            var model = new ApiSpecialOfferRequestModel();

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

            result.Success.Should().BeTrue();
            return(result.Record);
        }
コード例 #2
0
        public void MapModelToBO()
        {
            var mapper = new BOLSpecialOfferMapper();
            ApiSpecialOfferRequestModel model = new ApiSpecialOfferRequestModel();

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

            response.Category.Should().Be("A");
            response.Description.Should().Be("A");
            response.DiscountPct.Should().Be(1m);
            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.MaxQty.Should().Be(1);
            response.MinQty.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Type.Should().Be("A");
        }
コード例 #3
0
        public void CreatePatch()
        {
            var mapper = new ApiSpecialOfferModelMapper();
            var model  = new ApiSpecialOfferRequestModel();

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

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

            patch.ApplyTo(response);
            response.Category.Should().Be("A");
            response.Description.Should().Be("A");
            response.DiscountPct.Should().Be(1m);
            response.EndDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.MaxQty.Should().Be(1);
            response.MinQty.Should().Be(1);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.StartDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Type.Should().Be("A");
        }