public void GenerateId_generates_unique_greater_than0_ids() { var id1 = _generatorService.GenerateId(); id1.Should().BeGreaterThan(0); var id2 = _generatorService.GenerateId(); id2.Should().BeGreaterThan(0); id1.Should().NotBe(id2, "Should be unique"); }
public WorkTime CreateStartedManually(User.User user, DateTime endDate, bool start = false) { if (endDate <= InternalTimeService.GetCurrentDateTime()) { throw new ArgumentException("Invalid end date"); } var id = _idGenerator.GenerateId(); //todo long var workTime = new WorkTime(id, user, null, endDate); if (start) { workTime.StartManually(); } _repository.Save(workTime); workTime.MarkPendingEventsAsHandled(); return(workTime); }