private async Task <ApiDepartmentResponseModel> CreateRecord()
        {
            var model = new ApiDepartmentRequestModel();

            model.SetProperties("B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B");
            CreateResponse <ApiDepartmentResponseModel> result = await this.Client.DepartmentCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Beispiel #2
0
        public void MapModelToBO()
        {
            var mapper = new BOLDepartmentMapper();
            ApiDepartmentRequestModel model = new ApiDepartmentRequestModel();

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

            response.GroupName.Should().Be("A");
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiDepartmentModelMapper();
            var model  = new ApiDepartmentRequestModel();

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

            response.DepartmentID.Should().Be(1);
            response.GroupName.Should().Be("A");
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiDepartmentModelMapper();
            var model  = new ApiDepartmentRequestModel();

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

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

            patch.ApplyTo(response);
            response.GroupName.Should().Be("A");
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
        }