Exemple #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new ChatMapper();
            var model  = ChatsMockingSetup.DoMockingSetupForChatModel(1);
            var entity = ChatsMockingSetup.DoMockingSetupForChat(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 <ChatMapper>();

            mockMapper.Setup(x => x.MapToEntity(It.IsAny <IChatModel>(), It.IsAny <int>()));
            var mockModel = ChatsMockingSetup.DoMockingSetupForChatModel(1);

            ChatMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockModel.Object.MapToEntity();
            // Assert
            mockMapper.Verify(x => x.MapToEntity(It.IsAny <IChatModel>(), It.IsAny <int>()), Times.Once);
        }
Exemple #3
0
        public void Verify_MapToModelLite_AssignsLiteOnlyChatProperties()
        {
            // Arrange
            var mapper = new ChatMapper();
            var entity = ChatsMockingSetup.DoMockingSetupForChat();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            Assert.Equal(entity.Object.ChannelName, model.ChannelName);
            Assert.Equal(entity.Object.PasswordHash, model.PasswordHash);
            // Related Objects
            Assert.Equal(entity.Object.ImageFileId, model.ImageFileId);
        }
Exemple #4
0
        public void Verify_MapToEntity_AssignsChatProperties()
        {
            // Arrange
            var mapper = new ChatMapper();
            var model  = ChatsMockingSetup.DoMockingSetupForChatModel();
            // Act
            var entity = mapper.MapToEntity(model.Object);

            // Assert
            Assert.Equal(model.Object.ChannelName, entity.ChannelName);
            Assert.Equal(model.Object.PasswordHash, entity.PasswordHash);
            // Related Objects
            Assert.Equal(model.Object.ImageFileId, entity.ImageFileId);
            // Associated Objects
            // <None>
        }
Exemple #5
0
        public void Verify_MapToSearchModel_AssignsChatSearchProperties()
        {
            // Arrange
            var mapper = new ChatMapper();
            var model  = ChatsMockingSetup.DoMockingSetupForChatModel();
            // Act
            var searchModel = mapper.MapToSearchModel(model.Object);

            // Assert
            Assert.Equal(model.Object.ImageFileId, searchModel.ImageFileId);
            Assert.Equal(model.Object.ImageFile?.CustomKey, searchModel.ImageFileCustomKey);
            Assert.Equal(model.Object.ImageFile?.ApiDetailUrl, searchModel.ImageFileApiDetailUrl);
            Assert.Equal(model.Object.ImageFile?.SiteDetailUrl, searchModel.ImageFileSiteDetailUrl);
            Assert.Equal(model.Object.ImageFile?.Name, searchModel.ImageFileName);
            Assert.Equal(model.Object.ImageFile?.ShortDescription, searchModel.ImageFileShortDescription);
            Assert.Equal(model.Object.ImageFile?.Description, searchModel.ImageFileDescription);
            Assert.Equal(model.Object.ChannelName, searchModel.ChannelName);
        }