public void NotReturnAnyRoomsWithDuplicateIdsIfNoIdsAreSpecified() { var target = new RoomCollectionBuilder(); int count = 100.GetRandom(25); for (int i = 0; i < count; i++) { target.Add(new Room()); target.Add(new RoomBuilder()); } var actual = target.Build(); Assert.Equal(2 * count, actual.Select(r => r.Id).Distinct().Count()); }
public void ThrowADuplicateEntityExceptionIfARoomBuilderIsAddedWithAnIdAlreadyAddedAsARoomBuilder() { int id = Int32.MaxValue.GetRandom(); var target = new RoomCollectionBuilder() .Add(new RoomBuilder().Id(id)); Assert.Throws <DuplicateEntityException>(() => target.Add(new RoomBuilder().Id(id))); }