Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void When_AddMusician_is_called_with_then_the_Musician_is_added_to_the_collection()
        {
            var entity = MusicianCreator.CreateSingle();

            BandCatalog
            .Expect(catalog => catalog.Add(entity))
            .Return(entity)
            .Repeat.Once();
            BandCatalog.Replay();

            entity = Repository.AddMusician(entity);

            Assert.IsNotNull(entity);

            BandCatalog.VerifyAllExpectations();
        }
Exemplo n.º 3
0
        public void When_UpdateMusician_is_called_with_a_valid_Musician_then_the_Musician_is_updated_in_the_collection()
        {
            var entity = MusicianCreator.CreateSingle();

            BandCatalog
            .Expect(catalog => catalog.Update(entity))
            .Return(entity)
            .Repeat.Once();
            BandCatalog.Replay();

            entity = Repository.UpdateMusician(entity);

            Assert.IsNotNull(entity);

            BandCatalog.VerifyAllExpectations();
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
Arquivo: Band.cs Projeto: tpatall/mso
 public void RegisterMusicianCreator(MusicianCreator creator)
 {
     this.musicianCreators.Add(creator);
 }