public void CreateEvent_Returns_Event_With_Uri()
        {
            //Arrange
            var newEvent = new Event
            {
                Title = "New Event"
            };
            var eventService = A.Fake<IEventsService>();
            A.CallTo(() => eventService.AddEvent(A<Event>.Ignored)).Invokes(x =>
                {
                    var evt = x.GetArgument<Event>("newEvent");
                    evt.ID = 1;
                });
            var controller = new EventsController(eventService);
            WebApiTestHelper.SetupController(controller, "events/createEvent");

            //Act
            var response = controller.CreateEvent(newEvent);
            var eventContent = response.Content.ReadAsAsync<Event>().Result;

            //Assert
            Assert.Equal(HttpStatusCode.Created, response.StatusCode);
            Assert.Equal(newEvent, eventContent);
            Assert.True(response.Headers.Location.AbsoluteUri.EndsWith("eventID=" + eventContent.ID));
        }
        public void CreateEvent_Sets_Correct_Status_When_Model_Null()
        {
            //Arrange
            var eventService = A.Fake<IEventsService>();
            var controller = new EventsController(eventService);
            WebApiTestHelper.SetupController(controller, "events/createEvent");

            //Act
            var response = controller.CreateEvent(null);

            //Assert
            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
        }