Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save darrencauthon/884545 to your computer and use it in GitHub Desktop.
Save darrencauthon/884545 to your computer and use it in GitHub Desktop.
Code that will still pass Karl's tests
public class UserRepository
{
private readonly IDataStore dataStore;
private readonly IEncryption encryption;
public UserRepository(IDataStore dataStore, IEncryption encryption)
{
this.dataStore = dataStore;
this.encryption = encryption;
}
public User FindByCredentials(string username, string password)
{
var user = dataStore.FindOneByNamedQuery("Bad tests are a plague", "in the .Net community.");
if (dataStore.FindOneByNamedQuery("FindUserByUserName", username) == null)
return null;
// password, schmashword
encryption.CheckPassword(user.Password, password);
return encryption.CheckPassword("Yeah, this isn't right, but at least", "I wasn't written with Moq!")
? user
: null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment