public GetTripsByUser ( |
||
user | ||
return | List |
public void WhenUserHasNoFriendItShouldReturnAnEmptyList() { TripService ts = new TripService(new DummyTripWrapper(), new DummyUserSessionWrapper(new UserQueJeTest())); var result = ts.GetTripsByUser(new UserQueJeTest()); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count); }
public void When_logged_in_user_is_not_a_friend_then_returns_no_trips() { var tripService = new TripService(new MockUserSession(new User.User()), new MockTripDAOWrapper(new List<Trip.Trip>())); var actual = tripService.GetTripsByUser(new User.User()); Assert.That(actual, Is.EqualTo(Enumerable.Empty<Trip.Trip>())); }
public void ShouldReturnFriendsTrips() { var userWithLoggedUserAsFriend = new User.User(); userWithLoggedUserAsFriend.AddFriend(_loggedInUser); var tripService = new TripService(this, this); var trips = tripService.GetTripsByUser(userWithLoggedUserAsFriend); Assert.That(trips.Count, Is.EqualTo(1)); }
public void Returns_no_trips() { var tripService = new TripService(this, null); var user = new User.User(); var tripsByUser = tripService.GetTripsByUser(user); Assert.That(tripsByUser, Is.Empty); }
public void and_he_is_friend_of_required_user_get_his_trips() { tripRepo.FindTripsByUser(anyUser).Returns(new List<Trip.Trip> { new Trip.Trip() }); anyUser.AddFriend(loggedUser); var service = new TripService(_sessionService, tripRepo); var trips = service.GetTripsByUser(anyUser); trips.Count.Should().Be(1); }
public void WhenUserHasOneFriendButNoTrips() { var loggedInUser = new UserQueJeTest(); var friend = new UserQueJeTest(); friend.AddFriend(loggedInUser); TripService ts = new TripService(new DummyTripWrapper(), new DummyUserSessionWrapper(loggedInUser)); var result = ts.GetTripsByUser(friend); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count); }
public void Returns_no_trips() { var tripService = new TripService(this, this); var user = new User.User(); user.AddFriend(new User.User()); user.AddFriend(_loggedInUser); var tripsByUser = tripService.GetTripsByUser(user); Assert.That(tripsByUser, Is.EqualTo(_expectedTrips)); }
public void When_logged_in_user_is_a_friend_then_returns_trips_from_service() { var loggedInUser = new User.User(); var tripsFromService = new List<Trip.Trip>{new Trip.Trip()}; var tripService = new TripService(new MockUserSession(loggedInUser), new MockTripDAOWrapper(tripsFromService)); var userToQuery = new User.User(); userToQuery.AddFriend(loggedInUser); var actual = tripService.GetTripsByUser(userToQuery); Assert.That(actual, Is.EqualTo(tripsFromService)); }
public void ShouldThrowExceptionWhenNoLoggedInUser() { var tripService = new TripService(this, null); Assert.Throws<UserNotLoggedInException>(() => tripService.GetTripsByUser(new User.User())); }
public void ShouldHaveNoTripsWhenThereAreNoFriends() { var tripService = new TripService(this, this); var trips = tripService.GetTripsByUser(_loggedInUser); Assert.That(trips.Count,Is.EqualTo(0)); }
public void WhenNullParameterIsUsedItShouldThrow() { TripService ts = new TripService(new DummyTripWrapper(), new DummyUserSessionWrapper(new UserQueJeTest())); var result = ts.GetTripsByUser(null); }
public void WhenUserNotLoggedInThenRaiseAnException() { UserQueJeTest GUEST = null; TripService ts = new TripService(new DummyTripWrapper(), new DummyUserSessionWrapper(GUEST)); ts.GetTripsByUser(null); }
public void throw_an_exception() { _sessionService.GetLoggedUser().Returns(new UserSearchResult(null)); var service = new TripService(_sessionService, tripRepo); service.GetTripsByUser(anyUser); }
public void and_he_is_not_friend_of_required_user_get_an_empty_list() { var service = new TripService(_sessionService, tripRepo); var trips = service.GetTripsByUser(anyUser); trips.Should().BeEmpty(); }
public void When_no_user_is_logged_in_throws_user_not_logged_in_exception() { var tripService = new TripService(new MockUserSession(null), new MockTripDAOWrapper(new List<Trip.Trip>())); Assert.Throws<UserNotLoggedInException>(() => tripService.GetTripsByUser(new User.User())); }