public void Can_Count_All(int count) { Scaffold.Instances(count); double result = _service.CountAll(); Assert.Equal(count, result); }
public void Can_Get_All(int count) { Scaffold.Instances(count); IEnumerable <WorkflowInstancePoco> instances = _service.GetAll(); Assert.Equal(count, instances.Count()); }
public void Can_Get_Paged(int instanceCount, int page, int count, int expected) { Scaffold.Instances(instanceCount); List <WorkflowInstanceViewModel> instances = _service.Get(page, count); Assert.Equal(expected, instances.Count); }
public void Can_Count_Pending(int pendingCount, int approvedCount) { Scaffold.Instances(pendingCount); Scaffold.Instances(approvedCount, status: (int)WorkflowStatus.Approved); int result = _service.CountPending(); Assert.Equal(pendingCount, result); }
public void Can_Get_Filtered_Paged_For_Date_Range(int count, int daysAgo, int expected) { Scaffold.Instances(count); List <WorkflowInstanceViewModel> results = _service.GetFilteredPagedInstancesForDateRange(DateTime.Now.AddDays(daysAgo), expected, 1, "3"); // all instances are incomplete, so return regardless of daysAgo value Assert.Equal(expected, results.Count); }
public void Can_Get_For_Node_By_Status_When_Status_Null(int nodeId, int count) { Scaffold.Instances(count, nodeId: nodeId); List <WorkflowInstancePoco> results = _service.GetForNodeByStatus(nodeId, null).ToList(); Assert.Equal(count, results.Count); foreach (WorkflowInstancePoco result in results) { Assert.Equal(nodeId, result.NodeId); } }
public void Can_Get_For_Node_By_Status(int nodeId, int count, int status) { Scaffold.Instances(count, status: status, nodeId: nodeId); List <WorkflowInstancePoco> results = _service.GetForNodeByStatus(nodeId, new [] { status }).ToList(); Assert.Equal(count, results.Count); foreach (WorkflowInstancePoco result in results) { Assert.Equal(nodeId, result.NodeId); Assert.Equal(status, result.Status); } }
public void Can_Get_For_Date_Range(int count, int daysAgo, int expected) { IEnumerable <WorkflowInstancePoco> instances = Scaffold.Instances(count); List <WorkflowInstanceViewModel> results = _service.GetAllInstancesForDateRange(DateTime.Now.AddDays(daysAgo)); // all instances are incomplete, so return regardless of daysAgo value Assert.Equal(expected, results.Count); foreach (WorkflowInstancePoco instance in instances) { instance.CompletedDate = DateTime.Now.AddDays(daysAgo - 10); _service.UpdateInstance(instance); } results = _service.GetAllInstancesForDateRange(DateTime.Now.AddDays(daysAgo)); // all instances are now completed prior to the oldest date so should return an empty set Assert.Empty(results); }
public void Can_Get_All_Active_Instances() { int[] ids = { 1051, 1052, 1063 }; foreach (int id in ids) { Scaffold.Instances(1, nodeId: id); } Dictionary <int, bool> results = _service.IsActive(ids); Assert.True(results[ids[0]]); Assert.True(results[ids[1]]); Assert.True(results[ids[2]]); // try again, but with two ids with no attached instance int[] moreIds = { 1051, 3333, 4444 }; results = _service.IsActive(moreIds); Assert.True(results[moreIds[0]]); Assert.False(results[moreIds[1]]); Assert.False(results[moreIds[2]]); }