public void DTOMapperEntitiesToDTOTest() { Location location1 = new Location() { Name = "asdf", Address = "zxvc", LocationID = 1 }; Location location2 = new Location() { Name = "asdf", Address = "zxvc", LocationID = 2 }; IEnumerable<Location> locations = new List<Location>() { location1, location2 }; var dtos = mapper.GetDTOsForEntities<Location, LocationDTO>(locations); AssertLocationDTO(location1, dtos.First()); AssertLocationDTO(location2, dtos.Last()); }
public void DTOMapperEntityToDTOTest() { Location location = new Location() { Name = "asdf", Address = "zxvc", LocationID = 1 }; var dto = mapper.GetDTOForEntity<Location, LocationDTO>(location); AssertLocationDTO(location, dto); }
public void ActivityDTOTest() { Location location = new Location() { Name = "asdf", Address = "zxvc", LocationID = 1 }; Activity activity = new Activity() { ActivityID = 1, Name = "asdf", DayOfWeek = "Thursday", PreferredTime = new TimeSpan(1), Location = location }; var dto = new ActivityDTO(activity); AssertActivityDTO(activity, dto); }
public LocationDTO(Location location) : base(location) { }
public void EventDTOTest() { Location location = new Location() { Name = "asdf", Address = "zxvc", LocationID = 1 }; Activity activity = new Activity() { ActivityID = 1, Name = "asdf", DayOfWeek = "Thursday", PreferredTime = new TimeSpan(1), Location = location }; User user = new User() { Name = "kevin" }; Guest guest = new Guest() { Name = "kevin", Host = user }; Event ev = new Event() { Activity = activity, ActivityID = activity.ActivityID, UsersInEvent = new List<User>() { user }, GuestsInEvent = new List<Guest>() { guest }, DateTime = new DateTime(), EventID = 1, Name = "asdf" }; var dto = new EventDTO(ev); AssertEventDTO(ev, dto); Assert.AreEqual(1, dto.UsersInEvent.Count()); Assert.AreEqual(1, dto.GuestsInEvent.Count()); }
private void AssertLocationDTO(Location location, LocationDTO dto) { AssertDTO(location, dto, new [] { "Name", "Address", "LocationID" }); }
public void LocationDTOTest() { Location location = new Location() { Name = "asdf", Address = "zxvc", LocationID = 1 }; LocationDTO dto = new LocationDTO(location); AssertLocationDTO(location, dto); }