public void TheTimeEntryWhichHasBeenEditedTheLastWillBeRunningAndTheOtherWillBeStoppedAfterResolution(DateTimeOffset firstAt, DateTimeOffset secondAt)
        {
            (DateTimeOffset earlier, DateTimeOffset later) =
                firstAt < secondAt ? (firstAt, secondAt) : (secondAt, firstAt);
            var a = TimeEntry.Clean(new Ultrawave.Models.TimeEntry {
                Id = 1, Stop = null, At = earlier
            });
            var b = TimeEntry.Clean(new Ultrawave.Models.TimeEntry {
                Id = 2, Stop = null, At = later
            });

            var(fixedEntityA, fixedRivalB) = resolver.FixRivals(a, b, timeEntries);
            var(fixedEntityB, fixedRivalA) = resolver.FixRivals(b, a, timeEntries);

            fixedEntityA.Stop.Should().NotBeNull();
            fixedRivalA.Stop.Should().NotBeNull();
            fixedRivalB.Stop.Should().BeNull();
            fixedEntityB.Stop.Should().BeNull();
        }
示例#2
0
        public void TheTimeEntryWhichHasBeenEditedTheLastWillBeRunningAndTheOtherWillBeStoppedAfterResolution(DateTimeOffset startA, DateTimeOffset startB, DateTimeOffset firstAt, DateTimeOffset secondAt)
        {
            (DateTimeOffset earlier, DateTimeOffset later) =
                firstAt < secondAt ? (firstAt, secondAt) : (secondAt, firstAt);
            var a = TimeEntry.Clean(new MockTimeEntry {
                Id = 1, Start = startA, Duration = null, At = earlier
            });
            var b = TimeEntry.Clean(new MockTimeEntry {
                Id = 2, Start = startB, Duration = null, At = later
            });
            DateTimeOffset now = (startA > startB ? startA : startB).AddHours(5);

            timeService.CurrentDateTime.Returns(now);

            var(fixedEntityA, fixedRivalB) = resolver.FixRivals(a, b, timeEntries);
            var(fixedEntityB, fixedRivalA) = resolver.FixRivals(b, a, timeEntries);

            fixedEntityA.Duration.Should().NotBeNull();
            fixedRivalA.Duration.Should().NotBeNull();
            fixedRivalB.Duration.Should().BeNull();
            fixedEntityB.Duration.Should().BeNull();
        }