public void When_GetMusician_is_called_with_an_Id_and_there_is_no_Musician_in_the_collection_with_that_Id_then_an_InvalidOperationException_is_thrown() { var entities = MusicianCreator.CreateCollection(); var entityId = Guid.NewGuid(); BandCatalog .Expect(catalog => catalog.Musicians) .Return(entities) .Repeat.Once(); BandCatalog.Replay(); Repository.GetMusician(entityId); }
public void When_GetAllMusicians_is_called_then_all_Musicians_are_retrieved_from_the_collection() { var entities = MusicianCreator.CreateCollection(); BandCatalog .Expect(catalog => catalog.Musicians) .Return(entities) .Repeat.Once(); BandCatalog.Replay(); var result = Repository.GetAllMusicians(); Assert.IsNotNull(result); Assert.AreEqual(entities.Count(), result.Count()); Assert.AreEqual(entities, result); BandCatalog.VerifyAllExpectations(); }
public void When_GetMusician_is_called_with_an_Id_then_the_Musician_with_the_corresponding_Id_is_retrieved_from_the_collection() { var entities = MusicianCreator.CreateCollection(); var entityId = entities.ElementAt(2).Id; BandCatalog .Expect(catalog => catalog.Musicians) .Return(entities) .Repeat.Once(); BandCatalog.Replay(); var entity = Repository.GetMusician(entityId); Assert.IsNotNull(entity); Assert.AreEqual(entityId, entity.Id); BandCatalog.VerifyAllExpectations(); }