public void GetEventDetailsByRightId()
        {
            // given
            int eventId        = 1;
            var eventComparer  = new EventEqualityComparerForEventDetails();
            var expectedResult = _events.Find(e => e.Id == eventId);

            // when
            var eventDetails = _eventServices.GetEventDetails(eventId);

            // then
            Assert.IsNotNull(eventDetails);
            var actualResult = mapper.Map <EventDetailsModel, Event>(eventDetails);

            Assert.IsTrue(eventComparer.Equals(actualResult, expectedResult));
        }
Esempio n. 2
0
        // GET api/Events/GetEventDetails?eventId={eventId}
        public HttpResponseMessage GetEventDetails(int eventId)
        {
            var eventDetails = _eventServices.GetEventDetails(eventId);

            if (eventDetails != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, eventDetails));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Couldn't find event details"));
        }