public void test_assigned_session(string startDate, int duration, bool expectedResult) { var start = DateTime.ParseExact(startDate, "dd/MM/yyyy", new DateTimeFormatInfo()); var assignedSession = new AssignedSession(); assignedSession.Add(new DateTime(2017, 01, 15), 10); assignedSession.IsFreeFor(start, duration).Should().Be(expectedResult); }
public void Assign(DateTime sessionStart, int duration) { if (!_assignedSession.IsFreeFor(sessionStart, duration)) { throw new LocationAlreadyAssignedException(); } RaiseEvent(new LocationAssigned(AggregateId, GetNextSequence(), sessionStart, duration)); }