Created
March 24, 2011 03:55
-
-
Save darrencauthon/884545 to your computer and use it in GitHub Desktop.
Code that will still pass Karl's tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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