public void AssignWorkerAssignsWorkerToAll() { SumIndbetaling option1 = SumIndbetaling.Create(_mongoConnection, "test", "test", CreateSchedule()); SumIndbetaling option2 = SumIndbetaling.Create(_mongoConnection, "test", "test", CreateSchedule()); SumIndbetaling option3 = SumIndbetaling.Create(_mongoConnection, "test", "test", CreateSchedule()); Worker worker = new Worker(); worker.Create(_mongoConnection); OptionBase.AssignWorkerToAllUnassigned <SumIndbetaling>(worker, _mongoConnection); List <SumIndbetaling> optionsRead = OptionBase.ReadAllowed <SumIndbetaling>(_mongoConnection, null); Assert.IsTrue(optionsRead.All(option => option.Schedule.WorkerId == worker._id)); }
public void ReadAllowedTest() { Email emailCreatedAllowedIn2Days = CreateEmail(); emailCreatedAllowedIn2Days.Schedule.NextAllowedExecution = emailCreatedAllowedIn2Days.Schedule.NextAllowedExecution.AddDays(2); emailCreatedAllowedIn2Days.Update(_connection); Email emailCreatedAllowed = CreateEmail(); emailCreatedAllowed.Schedule.NextAllowedExecution = emailCreatedAllowed.Schedule.NextAllowedExecution.AddDays(-1); emailCreatedAllowed.Update(_connection); Email emailCreatedAllowedTomorrow = CreateEmail(); emailCreatedAllowedTomorrow.Schedule.NextAllowedExecution = emailCreatedAllowedTomorrow.Schedule.NextAllowedExecution.AddDays(1); emailCreatedAllowedTomorrow.Update(_connection); List <Email> emails = OptionBase.ReadAllowed <Email>(_connection, null); Email emailRetreived = emails.Single(); AssertEmail(emailCreatedAllowed, emailRetreived); }