public async Task DashboardItemIgnoredAnswer_Create_DoesCreate() { // Arrange var dashboardItemIgnoredAnswer = await DashboardHelpers.CreateDashboardItemIgnoredAnswer(DbContext); // Assert DashboardItemIgnoredAnswer dbDashboardItemIgnoredAnswer = DbContext.DashboardItemIgnoredAnswers.AsNoTracking().First(); List <DashboardItemIgnoredAnswer> dashboardItemIgnoredAnswers = DbContext.DashboardItemIgnoredAnswers.AsNoTracking().ToList(); Assert.NotNull(dbDashboardItemIgnoredAnswer); Assert.AreEqual(1, dashboardItemIgnoredAnswers.Count); Assert.AreEqual(dashboardItemIgnoredAnswer.Id, dbDashboardItemIgnoredAnswer.Id); Assert.AreEqual(1, dbDashboardItemIgnoredAnswer.Version); Assert.AreEqual(dashboardItemIgnoredAnswer.WorkflowState, dbDashboardItemIgnoredAnswer.WorkflowState); Assert.AreEqual(dashboardItemIgnoredAnswer.CreatedAt.ToString(CultureInfo.InvariantCulture), dbDashboardItemIgnoredAnswer.CreatedAt.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(dashboardItemIgnoredAnswer.CreatedByUserId, dbDashboardItemIgnoredAnswer.CreatedByUserId); Assert.AreEqual(dashboardItemIgnoredAnswer.UpdatedAt.ToString(), dbDashboardItemIgnoredAnswer.UpdatedAt.ToString()); Assert.AreEqual(dashboardItemIgnoredAnswer.UpdatedByUserId, dbDashboardItemIgnoredAnswer.UpdatedByUserId); Assert.AreEqual(dashboardItemIgnoredAnswer.AnswerId, dbDashboardItemIgnoredAnswer.AnswerId); Assert.AreEqual(dashboardItemIgnoredAnswer.DashboardItemId, dbDashboardItemIgnoredAnswer.DashboardItemId); }
public static async Task <DashboardItemIgnoredAnswer> CreateDashboardItemIgnoredAnswer(InsightDashboardPnDbContext dbContext) { var dashboardItem = await CreateDashboardItem(dbContext); Random rnd = new Random(); DashboardItemIgnoredAnswer dashboardItemIgnoredAnswer = new DashboardItemIgnoredAnswer { UpdatedByUserId = rnd.Next(1, 255), CreatedByUserId = rnd.Next(1, 255), CreatedAt = DateTime.UtcNow, UpdatedAt = DateTime.UtcNow, WorkflowState = Constants.WorkflowStates.Created, DashboardItemId = dashboardItem.Id, AnswerId = 1, }; await dashboardItemIgnoredAnswer.Create(dbContext);; return(dashboardItemIgnoredAnswer); }