Beispiel #1
0
        public void SetDueTime_ShouldSetDueDate()
        {
            var newDue = _utcNow.AddDays(3);

            _dut.SetDueTime(newDue);

            Assert.AreEqual(newDue, _dut.DueTimeUtc);
        }
Beispiel #2
0
        protected override void SetupNewDatabase(DbContextOptions <PreservationContext> dbContextOptions)
        {
            using (var context = new PreservationContext(dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                _testDataSet = AddTestDataSet(context);

                var tag        = _testDataSet.Project1.Tags.First();
                var attachment = new ActionAttachment(TestPlant, Guid.NewGuid(), "FileA");

                _openAction = new Action(TestPlant, "Open", "Desc1", _utcNow);
                tag.AddAction(_openAction);
                _closedAction = new Action(TestPlant, "Closed", "Desc2", _utcNow);
                _closedAction.Close(_utcNow, _testDataSet.CurrentUser);
                tag.AddAction(_closedAction);

                var tag2 = _testDataSet.Project1.Tags.Last();

                var personMock = new Mock <Person>();
                personMock.SetupGet(p => p.Id).Returns(7);

                _openActionWithEarliestDueTime = new Action(TestPlant, "OpenWithEarliestDueTime", "D2", _dueTimeUtc);
                _openActionWithDueTime         = new Action(TestPlant, "OpenWithDueTime", "D1", _dueTimeUtc);
                _openActionWithoutDueTime      = new Action(TestPlant, "OpenWithoutDueTime", "D3", _dueTimeUtc);
                _openActionWithoutDueTime.SetDueTime(null);
                _openAction.AddAttachment(attachment);
                _closedActionWithEarliestDueTime = new Action(TestPlant, "ClosedWithEarliestDueTime", "D5", _dueTimeUtc);
                _closedActionWithEarliestDueTime.Close(_utcNow, personMock.Object);
                _closedActionWithDueTime = new Action(TestPlant, "ClosedWithDueTime", "D4", _dueTimeUtc);
                _closedActionWithDueTime.Close(_utcNow, personMock.Object);
                _closedActionWithoutDueTime = new Action(TestPlant, "ClosedWithoutDueTime", "D6", _dueTimeUtc);
                _closedActionWithoutDueTime.SetDueTime(null);
                _closedActionWithoutDueTime.Close(_utcNow, personMock.Object);

                tag2.AddAction(_openActionWithoutDueTime);
                tag2.AddAction(_closedActionWithoutDueTime);
                tag2.AddAction(_openActionWithDueTime);
                tag2.AddAction(_closedActionWithDueTime);
                tag2.AddAction(_openActionWithEarliestDueTime);
                tag2.AddAction(_closedActionWithEarliestDueTime);

                context.SaveChangesAsync().Wait();

                _tagId          = tag.Id;
                _tag2Id         = tag2.Id;
                _openActionId   = _openAction.Id;
                _closedActionId = _closedAction.Id;
            }
        }