public void test_that_given_a_case_where_session_data_exists_in_the_database_get_should_return_a_non_empty_session_list() { // arrange var mockRepository = new Mock <ISessionRepository>(); mockRepository.Setup(m => m.GetAll()).Returns(SessionDataFactory.GetStandardSessions()); _container.Bind <ISessionRepository>().ToConstant(mockRepository.Object); var controller = (SessionController)_container.Get <IHttpController>("Session", new IParameter[0]); // act var result = controller.Get(); // assert Assert.AreNotEqual(0, result.Count()); }
public void test_that_given_a_valid_session_id_that_session_is_returned_from_the_get_with_id_call() { // arrange var sessions = SessionDataFactory.GetStandardSessions(); var mockRepository = new Mock <ISessionRepository>(); mockRepository.Setup(m => m.Get(It.IsAny <int>())).Returns(sessions[0]); _container.Bind <ISessionRepository>().ToConstant(mockRepository.Object); // act var controller = (SessionController)_container.Get <IHttpController>("Session", new IParameter[0]); var result = controller.Get(1); // assert Assert.IsNotNull(result); }