public void Can_serialize_checklist() { string json = ChecklistFactory.Serialize(checklist_); json.Should().NotBeEmpty(); File.WriteAllText(Path.Combine(Path.GetTempPath(), "checklist.json"), json); }
public void Can_serialize_then_parse_checklist() { ChecklistTestHelper.ChecklistTreeStructureShouldBeConsistent(checklist_); string json = ChecklistFactory.Serialize(checklist_); var checklist = ChecklistFactory.Parse(json); ChecklistTestHelper.ChecklistTreeStructureShouldBeConsistent(checklist); }
public void Can_serialize_then_parse_autoset() { TestDataHelper.ChecklistTreeStructureShouldBeConsistent(checklist_); checklist_.Find("R1,P2").SetAuto(); var checklistFactory = new ChecklistFactory(); string json = checklistFactory.Serialize(checklist_); var checklist = checklistFactory.Parse(json); TestDataHelper.ChecklistTreeStructureShouldBeConsistent(checklist); checklist.Find("R1,P2").IsAutoSet.Should().Be(true); }
public static MergePackage FromDomain(Domain.Mandate.Mandate mandate, Domain.Checklist.Checklist[] checklists) { Ensure.That(mandate, nameof(mandate)).IsNotNull(); Ensure.That(checklists, nameof(checklists)).IsNotNull(); Ensure.That(checklists, nameof(checklists)).HasItems(); foreach (var checklist in checklists) { Ensure.That(checklist, nameof(checklist)).IsNotNull(); } var mergePackage = new MergePackage(); var mandateFactory = new MandateFactory(); var checklistFactory = new ChecklistFactory(); mergePackage.Mandate = mandateFactory.Serialize(mandate); mergePackage.Checklists = checklistFactory.Serialize(checklists); return(mergePackage); //return new MergePackage() //{ // Mandate = mandate, // Checklists = checklists //}; }