예제 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new CharacterFriendMapper();
            var model  = CharacterFriendsMockingSetup.DoMockingSetupForCharacterFriendModel(1);
            var entity = CharacterFriendsMockingSetup.DoMockingSetupForCharacterFriend(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

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

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <ICharacterFriendModel>(), It.IsAny <int>()));
            var mockModel = CharacterFriendsMockingSetup.DoMockingSetupForCharacterFriendModel(1);

            CharacterFriendMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <ICharacterFriendModel>(), It.IsAny <int>()), Times.Once);
        }
예제 #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyCharacterFriendProperties()
        {
            // Arrange
            var mapper = new CharacterFriendMapper();
            var entity = CharacterFriendsMockingSetup.DoMockingSetupForCharacterFriend();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.CharacterId, model.CharacterId);
            Assert.Equal(entity.Object.FriendId, model.FriendId);
        }
예제 #4
0
        public void Verify_MapToEntity_AssignsCharacterFriendProperties()
        {
            // Arrange
            var mapper = new CharacterFriendMapper();
            var model  = CharacterFriendsMockingSetup.DoMockingSetupForCharacterFriendModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.CharacterId, entity.CharacterId);
            Assert.Equal(model.Object.FriendId, entity.FriendId);
            // Associated Objects
            // <None>
        }
예제 #5
0
        public void Verify_MapToSearchModel_AssignsCharacterFriendSearchProperties()
        {
            // Arrange
            var mapper = new CharacterFriendMapper();
            var model  = CharacterFriendsMockingSetup.DoMockingSetupForCharacterFriendModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.CharacterId, searchModel.CharacterId);
            Assert.Equal(model.Object.Character?.CustomKey, searchModel.CharacterCustomKey);
            Assert.Equal(model.Object.Character?.ApiDetailUrl, searchModel.CharacterApiDetailUrl);
            Assert.Equal(model.Object.Character?.SiteDetailUrl, searchModel.CharacterSiteDetailUrl);
            Assert.Equal(model.Object.Character?.Name, searchModel.CharacterName);
            Assert.Equal(model.Object.Character?.ShortDescription, searchModel.CharacterShortDescription);
            Assert.Equal(model.Object.Character?.Description, searchModel.CharacterDescription);
            Assert.Equal(model.Object.FriendId, searchModel.FriendId);
            Assert.Equal(model.Object.Friend?.CustomKey, searchModel.FriendCustomKey);
            Assert.Equal(model.Object.Friend?.ApiDetailUrl, searchModel.FriendApiDetailUrl);
            Assert.Equal(model.Object.Friend?.SiteDetailUrl, searchModel.FriendSiteDetailUrl);
            Assert.Equal(model.Object.Friend?.Name, searchModel.FriendName);
            Assert.Equal(model.Object.Friend?.ShortDescription, searchModel.FriendShortDescription);
            Assert.Equal(model.Object.Friend?.Description, searchModel.FriendDescription);
        }