public void TestRetrieve() { var r = WorkflowConfigurationRepository.Instance; var a = (IWorkflowConfiguration) new WorkflowConfiguration { Name = "What the f**k!" }; var task = new EndWorkflowTask { Name = "Test" }; a.StartTask = task; // a.Tasks.Add(task); r.Create(a); var id = a.Id; a = null; var b = r.GetById(id); b = r.RestoreState(b); Assert.IsNotNull(b); }
public void TestSerializeCollection() { IWorkflowTask t = new DelayWorkflowTask { Name = "JSON test" }; IWorkflowTask u = new EndWorkflowTask() { Name = "JSON test2" }; var l = new List <IWorkflowTask> { t, u }; var stream1 = new MemoryStream(); var ser = new DataContractJsonSerializer(typeof(WorkflowTaskCollectionUiAdapter), new List <Type> { typeof(WorkflowTaskUiAdapter) }); ser.WriteObject(stream1, new WorkflowTaskCollectionUiAdapter(l)); stream1.Position = 0; var sr = new StreamReader(stream1); Console.Write("JSON form of Task object: "); Console.WriteLine(sr.ReadToEnd()); Console.WriteLine(new JavaScriptSerializer().Serialize(new WorkflowTaskCollectionUiAdapter(l))); }
public void TestRetrieve() { var r = WorkflowInstanceRepository.Instance; var a = (IWorkflowInstance)new WorkflowInstance { Name = "What the f**k!" }; var task = new EndWorkflowTask { Name = "Test" }; //a. = task; a.Tasks.Add(task); r.Create(a); var id = a.Id; a = null; var b = r.GetById(id); b = r.RestoreState(b); Assert.IsNotNull(b); }
public void TestSerializeCollection() { IWorkflowTask t = new DelayWorkflowTask { Name = "JSON test" }; IWorkflowTask u = new EndWorkflowTask() {Name = "JSON test2"}; var l = new List<IWorkflowTask> {t, u}; var stream1 = new MemoryStream(); var ser = new DataContractJsonSerializer(typeof(WorkflowTaskCollectionUiAdapter), new List<Type> { typeof(WorkflowTaskUiAdapter) }); ser.WriteObject(stream1, new WorkflowTaskCollectionUiAdapter(l)); stream1.Position = 0; var sr = new StreamReader(stream1); Console.Write("JSON form of Task object: "); Console.WriteLine(sr.ReadToEnd()); Console.WriteLine(new JavaScriptSerializer().Serialize(new WorkflowTaskCollectionUiAdapter(l))); }