예제 #1
0
        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());
        }
예제 #2
0
        public void DTOMapperEntityToDTOTest()
        {
            Location location = new Location()
            {
                Name = "asdf",
                Address = "zxvc",
                LocationID = 1
            };

            var dto = mapper.GetDTOForEntity<Location, LocationDTO>(location);

            AssertLocationDTO(location, dto);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public LocationDTO(Location location)
     : base(location)
 {
 }
예제 #5
0
        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());
        }
예제 #6
0
 private void AssertLocationDTO(Location location, LocationDTO dto)
 {
     AssertDTO(location, dto, new [] {
         "Name", "Address", "LocationID"
     });
 }
예제 #7
0
        public void LocationDTOTest()
        {
            Location location = new Location()
            {
                Name = "asdf",
                Address = "zxvc",
                LocationID = 1
            };

            LocationDTO dto = new LocationDTO(location);

            AssertLocationDTO(location, dto);
        }