private IEnumerable <VbaCodeIssue> Inspect <TInspection>(string moduleName, RubberduckParserState parserState, ResultFetchMethod resultFetchMethod)
            where TInspection : IInspection
        {
            IEnumerable <IInspectionResult> inspectionResults = InspectionFactory.Create <TInspection>(parserState, resultFetchMethod).GetInspectionResults();

            return(inspectionResults.GroupBy(x => x.Description).Select(x => x.First()).Select(item => new VbaCodeIssue(item, _fileName, moduleName)));
        }
Exemple #2
0
        public void Can_serialize_inspection()
        {
            string json = new InspectionFactory().Serialize(inspection_);

            json.Should().NotBeEmpty();
            File.WriteAllText(Path.Combine(Path.GetTempPath(), "inspection.json"), json);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }