public void When_GetBand_is_called_without_an_Id_and_the_current_Band_is_not_Known_then_an_InvalidOperationException_is_thrown() { AppCatalog .Expect(catalog => catalog.CurrentBand) .Return(null) .Repeat.Once(); AppCatalog.Replay(); Repository.GetBand(); }
public void When_GetLoginAccountByLoginName_is_called_with_an_invalid_loginName_then_a_InvalidOperationException_is_thrown() { var loginAccounts = LoginAccountCreator.CreateCollection(); const string loginName = "Invalid loginName"; AppCatalog .Expect(catalog => catalog.LoginAccounts) .Return(loginAccounts) .Repeat.Once(); AppCatalog.Replay(); Repository.GetLoginAccountByLoginName(loginName); }
public void When_GetBand_is_called_with_an_Id_and_there_is_no_Band_in_the_collection_with_that_Id_then_an_InvalidOperationException_is_thrown() { var bands = BandCreator.CreateCollection(); var bandId = Guid.NewGuid(); AppCatalog .Expect(catalog => catalog.Bands) .Return(bands) .Repeat.Once(); AppCatalog.Replay(); Repository.GetBand(bandId); }
public void When_UpdateBand_is_called_with_a_null_value_for_Band_then_an_ArgumentNullException_is_thrown() { AppCatalog .Expect(catalog => catalog.Update(Arg <Band> .Is.Anything)) .Return(null) .Repeat.Once(); AppCatalog.Replay(); Repository.UpdateBand(null); AppCatalog.VerifyAllExpectations(); }
public void When_AddBand_is_called_with_a_valid_Band_then_the_Band_is_added_to_the_collection() { var band = BandCreator.CreateSingle(); AppCatalog .Expect(catalog => catalog.Add(band)) .Return(band) .Repeat.Once(); AppCatalog.Replay(); band = Repository.AddBand(band); Assert.IsNotNull(band); AppCatalog.VerifyAllExpectations(); }
public void When_UpdateBand_is_called_with_a_valid_Band_then_the_Band_is_updated_in_the_collection() { var entity = BandCreator.CreateSingle(); AppCatalog .Expect(catalog => catalog.Update(entity)) .Return(entity) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.UpdateBand(entity); Assert.IsNotNull(result); Assert.AreEqual(entity.Id, result.Id); AppCatalog.VerifyAllExpectations(); }
public void When_GetBand_is_called_without_an_Id_then_the_current_Band_is_retrieved_from_the_collection() { var band = BandCreator.CreateSingle(); AppCatalog .Expect(catalog => catalog.CurrentBand) .Return(band) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetBand(); Assert.IsNotNull(result); Assert.AreEqual(band, result); AppCatalog.VerifyAllExpectations(); }
public void When_GetLoginAccountByLoginName_is_called_with_a_loginName_then_the_LoginAccount_with_that_loginName_is_retrieved_from_the_collection() { var loginAccounts = LoginAccountCreator.CreateCollection(); var loginName = loginAccounts.ElementAt(2).LoginName; AppCatalog .Expect(catalog => catalog.LoginAccounts) .Return(loginAccounts) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetLoginAccountByLoginName(loginName); Assert.IsNotNull(result); Assert.AreEqual(loginName, result.LoginName); AppCatalog.VerifyAllExpectations(); }
public void When_GetUsersByEmailAddress_is_called_with_an_invalid_emailAddress_then_no_Users_with_that_emailAddress_are_retrieved_from_the_collection() { var users = UserCreator.CreateCollection(); const string emailAddress = "*****@*****.**"; AppCatalog .Expect(catalog => catalog.Users) .Return(users) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetUsersByEmailAddress(emailAddress); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count()); AppCatalog.VerifyAllExpectations(); }
public void When_GetUsersByLoginName_is_called_with_an_invalid_loginName_then_no_Users_with_that_loginName_are_retrieved_from_the_collection() { var users = UserCreator.CreateCollection(); const string loginName = "Invalid loginName"; AppCatalog .Expect(catalog => catalog.Users) .Return(users) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetUsersByLoginName(loginName); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count()); AppCatalog.VerifyAllExpectations(); }
public void When_GetUsersByLoginAccount_is_called_with_an_invalid_id_then_no_Users_are_retrieved_from_the_collection() { var users = UserCreator.CreateCollection(); var id = Guid.NewGuid(); AppCatalog .Expect(catalog => catalog.Users) .Return(users) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetUsersByLoginAccount(id); Assert.IsNotNull(result); Assert.AreEqual(0, result.Count()); AppCatalog.VerifyAllExpectations(); }
public void When_GetAllUsers_is_called_then_all_Users_are_retrieved_from_the_collection() { var users = UserCreator.CreateCollection(); AppCatalog .Expect(catalog => catalog.Users) .Return(users) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetAllUsers(); Assert.IsNotNull(result); Assert.AreEqual(users.Count(), result.Count()); Assert.AreEqual(users, result); AppCatalog.VerifyAllExpectations(); }
public void When_GetBand_is_called_with_an_Id_then_the_Band_with_the_corresponding_Id_is_retrieved_from_the_collection() { var bands = BandCreator.CreateCollection(); var bandId = bands.ElementAt(2).Id; AppCatalog .Expect(catalog => catalog.Bands) .Return(bands) .Repeat.Once(); AppCatalog.Replay(); var band = Repository.GetBand(bandId); Assert.IsNotNull(band); Assert.AreEqual(bandId, band.Id); AppCatalog.VerifyAllExpectations(); }
public void When_GetUsersByEmailAddress_is_called_with_a_emailAddress_then_all_Users_with_that_emailAddress_are_retrieved_from_the_collection() { var users = UserCreator.CreateCollection(); var emailAddress = users.ElementAt(2).Login.EmailAddress; AppCatalog .Expect(catalog => catalog.Users) .Return(users) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetUsersByEmailAddress(emailAddress); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count()); Assert.AreEqual(emailAddress, result.First().Login.EmailAddress); AppCatalog.VerifyAllExpectations(); }
public void When_GetUsersByLoginAccount_is_called_with_a_valid_id_then_all_Users_with_that_LoginAccount_are_retrieved_from_the_collection() { var users = UserCreator.CreateCollection(); var id = users.ElementAt(2).Login.Id; AppCatalog .Expect(catalog => catalog.Users) .Return(users) .Repeat.Once(); AppCatalog.Replay(); var result = Repository.GetUsersByLoginAccount(id); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count()); Assert.AreEqual(id, result.First().Login.Id); AppCatalog.VerifyAllExpectations(); }