public UserManagementServiceTest() { var userRepository = new MockUserRepository(); userManagementService = new UserManagementService( new MockConnectionAvailableService(), new UpdateUserArgsValidator(userRepository), userRepository ); }
public void WhenUpdatingAUser_AndTheDatabaseCannotBeReached_ItThrowsASqlException() { // arrange var updateUserArgs = new UpsertUserArgs(1, "John"); var userRepository = new MockUserRepository(); userManagementService = new UserManagementService( new MockConnectionUnavailableService(), new UpdateUserArgsValidator(userRepository), userRepository ); // act Action updateUser = () => userManagementService.Update(updateUserArgs); // assert updateUser.Should().Throw <SqlException>(); }