Exemple #1
0
        public void MapBand()
        {
            //Arrange
            var id = Guid.NewGuid();

            var entity = new BandEntity
            {
                Id               = id,
                Country          = "Country",
                Events           = new List <EventEntity>(),
                Genre            = "Genre",
                ImagePath        = "ImagePath",
                LongDescription  = "Long Description",
                Name             = "Name",
                ShortDescription = "Short Description"
            };

            var model = new BandDetailModel
            {
                Id               = id,
                Country          = "Country",
                Events           = new List <EventDetailModel>(),
                Genre            = "Genre",
                ImagePath        = "ImagePath",
                LongDescription  = "Long Description",
                Name             = "Name",
                ShortDescription = "Short Description"
            };


            //Act
            var entityAdapted = model.Adapt <BandEntity>();

            entityAdapted.Events = model.Events.Adapt <List <EventEntity> >();

            var modelAdapted = entity.Adapt <BandDetailModel>();

            modelAdapted.Events = entity.Events.Adapt <List <EventDetailModel> >();

            //Assert
            Assert.Equal(entity, entityAdapted, BandEntity.BandEntityComparer);
            Assert.Equal(model, modelAdapted, BandDetailModel.BandDetailModelComparer);
        }
Exemple #2
0
        public void Create()
        {
            //Arrange
            var band = new BandDetailModel
            {
                Country          = "Czech",
                Genre            = "Rock",
                ImagePath        = "C:/Users/testUser/Images/image.jpg",
                LongDescription  = "Long description of band",
                ShortDescription = "Short description of band"
            };

            //Act
            var id = _fixture.Facade.Create(band);

            //Assert
            var bandStored = _fixture.Repository.GetById(id);

            var storedBandToModel = bandStored.Adapt <BandDetailModel>();

            Assert.Equal(band, storedBandToModel, BandDetailModel.BandDetailModelComparer);
        }
 public void Load(Guid id)
 {
     Model = _eventFacade.GetById(id) ?? new BandDetailModel();
 }