예제 #1
0
        public void Can_serialize_then_parse_inspection()
        {
            TestDataHelper.InspectionShouldBeSuchAsConstructed(inspection_);
            var    factory    = new InspectionFactory();
            string json       = factory.Serialize(inspection_);
            var    inspection = factory.Parse(json);

            TestDataHelper.InspectionShouldBeSuchAsConstructed(inspection);
        }
예제 #2
0
        public void Can_serialize_then_parse_inspection_with_pdf_report()
        {
            TestDataHelper.InspectionShouldBeSuchAsConstructed(inspection_);
            inspection_.SetPdfReport(new PdfReport(new InspectionPdf(InspectionPdfModel.FromDomain(inspection_, farm_, checklist_, "JU", "")
                                                                     , "the_user").CreatePdf()));
            var    factory    = new InspectionFactory();
            string json       = factory.Serialize(inspection_);
            var    inspection = factory.Parse(json);

            TestDataHelper.InspectionShouldBeSuchAsConstructed(inspection);
            inspection.PdfReport.Should().Be(inspection_.PdfReport);
        }
        private Domain.Mandate.Mandate Parse(MandateDeserializationDto dto)
        {
            if (dto == null)
            {
                return(null);
            }
            int farmId            = dto.FarmId;
            var inspectionFactory = new InspectionFactory();
            var inspections       = new List <Domain.Inspection.Inspection>();

            foreach (var inspection in dto.Inspections)
            {
                inspections.Add(inspectionFactory.Parse(inspection));
            }
            var mandate = new Domain.Mandate.Mandate(farmId, inspections);

            return(mandate);
        }