예제 #1
0
        private async Task <ApiTransactionHistoryArchiveResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiTransactionHistoryArchiveRequestModel();

            model.SetProperties(2m, DateTime.Parse("1/1/1988 12:00:00 AM"), 2, 2, 2, 2, DateTime.Parse("1/1/1988 12:00:00 AM"), "B");
            CreateResponse <ApiTransactionHistoryArchiveResponseModel> result = await client.TransactionHistoryArchiveCreateAsync(model);

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

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

            response.ActualCost.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ProductID.Should().Be(1);
            response.Quantity.Should().Be(1);
            response.ReferenceOrderID.Should().Be(1);
            response.ReferenceOrderLineID.Should().Be(1);
            response.TransactionDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.TransactionType.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiTransactionHistoryArchiveModelMapper();
            var model  = new ApiTransactionHistoryArchiveRequestModel();

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

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

            patch.ApplyTo(response);
            response.ActualCost.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.ProductID.Should().Be(1);
            response.Quantity.Should().Be(1);
            response.ReferenceOrderID.Should().Be(1);
            response.ReferenceOrderLineID.Should().Be(1);
            response.TransactionDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.TransactionType.Should().Be("A");
        }