public void RetrievesUsersThatExist() { var spy = new UserRepositorySpy(); var command = new CreateOrRetrieveUserByName(spy); var user = command.Execute("Alice"); Assert.Null(spy.AddCalledWith); Assert.Equal("Alice", user.Name); }
public void CreatesAUserIfNotExisting() { var spy = new UserRepositorySpy(); var command = new CreateOrRetrieveUserByName(spy); var user = command.Execute("Bob"); Assert.Equal("Bob", spy.AddCalledWith.Name); Assert.Equal("Bob", user.Name); }