Exemple #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new EpisodeTeamMapper();
            var model  = EpisodeTeamsMockingSetup.DoMockingSetupForEpisodeTeamModel(1);
            var entity = EpisodeTeamsMockingSetup.DoMockingSetupForEpisodeTeam(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
Exemple #2
0
        public void Verify_MapToEntityExtension_CallsMapToEntity()
        {
            // Arrange
            var mockMapper = new Mock <EpisodeTeamMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IEpisodeTeamModel>(), It.IsAny <int>()));
            var mockModel = EpisodeTeamsMockingSetup.DoMockingSetupForEpisodeTeamModel(1);

            EpisodeTeamMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IEpisodeTeamModel>(), It.IsAny <int>()), Times.Once);
        }
Exemple #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyEpisodeTeamProperties()
        {
            // Arrange
            var mapper = new EpisodeTeamMapper();
            var entity = EpisodeTeamsMockingSetup.DoMockingSetupForEpisodeTeam();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.EpisodeId, model.EpisodeId);
            Assert.Equal(entity.Object.TeamId, model.TeamId);
        }
Exemple #4
0
        public void Verify_MapToEntity_AssignsEpisodeTeamProperties()
        {
            // Arrange
            var mapper = new EpisodeTeamMapper();
            var model  = EpisodeTeamsMockingSetup.DoMockingSetupForEpisodeTeamModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.EpisodeId, entity.EpisodeId);
            Assert.Equal(model.Object.TeamId, entity.TeamId);
            // Associated Objects
            // <None>
        }
Exemple #5
0
        public void Verify_MapToSearchModel_AssignsEpisodeTeamSearchProperties()
        {
            // Arrange
            var mapper = new EpisodeTeamMapper();
            var model  = EpisodeTeamsMockingSetup.DoMockingSetupForEpisodeTeamModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.EpisodeId, searchModel.EpisodeId);
            Assert.Equal(model.Object.Episode?.CustomKey, searchModel.EpisodeCustomKey);
            Assert.Equal(model.Object.Episode?.ApiDetailUrl, searchModel.EpisodeApiDetailUrl);
            Assert.Equal(model.Object.Episode?.SiteDetailUrl, searchModel.EpisodeSiteDetailUrl);
            Assert.Equal(model.Object.Episode?.Name, searchModel.EpisodeName);
            Assert.Equal(model.Object.Episode?.ShortDescription, searchModel.EpisodeShortDescription);
            Assert.Equal(model.Object.Episode?.Description, searchModel.EpisodeDescription);
            Assert.Equal(model.Object.TeamId, searchModel.TeamId);
            Assert.Equal(model.Object.Team?.CustomKey, searchModel.TeamCustomKey);
            Assert.Equal(model.Object.Team?.ApiDetailUrl, searchModel.TeamApiDetailUrl);
            Assert.Equal(model.Object.Team?.SiteDetailUrl, searchModel.TeamSiteDetailUrl);
            Assert.Equal(model.Object.Team?.Name, searchModel.TeamName);
            Assert.Equal(model.Object.Team?.ShortDescription, searchModel.TeamShortDescription);
            Assert.Equal(model.Object.Team?.Description, searchModel.TeamDescription);
        }