示例#1
0
        private async Task <ApiDocumentResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiDocumentRequestModel();

            model.SetProperties(2, BitConverter.GetBytes(2), 2, "B", "B", "B", true, DateTime.Parse("1/1/1988 12:00:00 AM"), 2, "B", 2, "B");
            CreateResponse <ApiDocumentResponseModel> result = await client.DocumentCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
示例#2
0
        public void MapModelToBO()
        {
            var mapper = new BOLDocumentMapper();
            ApiDocumentRequestModel model = new ApiDocumentRequestModel();

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

            response.ChangeNumber.Should().Be(1);
            response.Document1.Should().BeEquivalentTo(BitConverter.GetBytes(1));
            response.DocumentLevel.Should().Be(1);
            response.DocumentSummary.Should().Be("A");
            response.FileExtension.Should().Be("A");
            response.FileName.Should().Be("A");
            response.FolderFlag.Should().Be(true);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Owner.Should().Be(1);
            response.Revision.Should().Be("A");
            response.Status.Should().Be(1);
            response.Title.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiDocumentModelMapper();
            var model  = new ApiDocumentRequestModel();

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

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

            patch.ApplyTo(response);
            response.ChangeNumber.Should().Be(1);
            response.Document1.Should().BeEquivalentTo(BitConverter.GetBytes(1));
            response.DocumentLevel.Should().Be(1);
            response.DocumentSummary.Should().Be("A");
            response.FileExtension.Should().Be("A");
            response.FileName.Should().Be("A");
            response.FolderFlag.Should().Be(true);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Owner.Should().Be(1);
            response.Revision.Should().Be("A");
            response.Status.Should().Be(1);
            response.Title.Should().Be("A");
        }