public void Can_parse_checklist() { var json = File.ReadAllText("./Data/checklist.json"); var checklist = ChecklistFactory.Parse(json); ChecklistTestHelper.ChecklistTreeStructureShouldBeConsistent(checklist); }
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); }
void InitChecklistAndValidator() { checklist = ChecklistFactory.Get(SimulationSession.Current.simulationMode); validator = ChecklistFactory.GetValidator(SimulationSession.Current.simulationMode, checklist); validator.onError += (err) => errors.Add(err); validator.onPass += (TaskType t, bool compl) => checklist.SetTaskCompletion(t, compl); validator.onFail += () => { SimulationEvents.Emit(EventType.SimulationFailed); simulationComplete = false; }; validator.onSuccess += () => { SimulationEvents.Emit(EventType.SimulationSuccess); simulationComplete = 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 //}; }
public async ValueTask SaveChecklistAsync(Checklist checklist) { string json = new ChecklistFactory().Serialize(checklist); await localStorage_.SetItemAsync(ChecklistKey(checklist), json); }