public void MockRetrieveWorkspacesWhereAppIsInstalledAsync(bool applicationPreviouslyInstalled, int?workspaceArtifactId) { if (!applicationPreviouslyInstalled) { MockSqlQueryHelper .Setup(x => x.RetrieveWorkspacesWhereAppIsInstalledAsync(MockDbContextEdds.Object)) .Returns(Task.FromResult <DataRow>(null)); } else { var dtWorkspace = new DataTable(); var colCaseArtifactId = new DataColumn { DataType = typeof(int), ColumnName = "CaseArtifactId" }; dtWorkspace.Columns.Add(colCaseArtifactId); var drWorkspace = dtWorkspace.NewRow(); drWorkspace["CaseArtifactId"] = workspaceArtifactId; dtWorkspace.Rows.Add(drWorkspace); MockSqlQueryHelper .Setup(x => x.RetrieveWorkspacesWhereAppIsInstalledAsync(MockDbContextEdds.Object)) .Returns(Task.FromResult(dtWorkspace.Rows[0])); } }
public void MockRetrieveSingleInExportManagerQueueByArtifactIdAsync_ReturnsDataRow() { DataTable dtQueue = new DataTable(); dtQueue.Columns.Add(new DataColumn("ID", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("AgentID", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("JobID", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("WorkspaceArtifactID", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("ObjectType", typeof(string))); dtQueue.Columns.Add(new DataColumn("QueueStatus", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("ResultTableName", typeof(string))); dtQueue.Columns.Add(new DataColumn("Priority", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("ResourceGroupID", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("CreatedBy", typeof(Int32))); dtQueue.Columns.Add(new DataColumn("TimeStampUTC", typeof(DateTime))); dtQueue.Rows.Add(1, 2, 3, 4, "User", 0, "tempTableName", 1, 5, 6, DateTime.Now); MockSqlQueryHelper .Setup(x => x.RetrieveSingleInExportManagerQueueByArtifactIdAsync(MockDbContextEdds.Object, It.IsAny <int>(), It.IsAny <int>())) .Returns(Task.FromResult(dtQueue.Rows[0])); }
public void MockRetrieveSingleInExportManagerQueueByArtifactIdAsync_ReturnsNoDataRows() { MockSqlQueryHelper .Setup(x => x.RetrieveSingleInExportManagerQueueByArtifactIdAsync(MockDbContextEdds.Object, It.IsAny <int>(), It.IsAny <int>())) .Returns(Task.FromResult <DataRow>(null)); }