コード例 #1
0
        public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse()
        {
            // Arrange
            var mapper = new VolumeObjectMapper();
            var model  = VolumeObjectsMockingSetup.DoMockingSetupForVolumeObjectModel(1);
            var entity = VolumeObjectsMockingSetup.DoMockingSetupForVolumeObject(2);
            // Act
            var result = mapper.AreEqual(model.Object, entity.Object);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void Verify_MapToModelLite_AssignsLiteOnlyVolumeObjectProperties()
        {
            // Arrange
            var mapper = new VolumeObjectMapper();
            var entity = VolumeObjectsMockingSetup.DoMockingSetupForVolumeObject();
            // Act
            var model = mapper.MapToModelLite(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.VolumeId, model.VolumeId);
            Assert.Equal(entity.Object.ObjectId, model.ObjectId);
        }
コード例 #3
0
        public void Verify_MapToModelListingExtension_CallsMapToModel()
        {
            // Arrange
            var mockMapper = new Mock <VolumeObjectMapper>();

            mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IVolumeObject>(), It.IsAny <int>()));
            var mockEntity = VolumeObjectsMockingSetup.DoMockingSetupForVolumeObject(1);

            VolumeObjectMapperExtensions.OverrideMapper(mockMapper.Object);
            // Act
            mockEntity.Object.MapToModelListing();
            // Assert
            mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IVolumeObject>(), It.IsAny <int>()), Times.Once);
        }
コード例 #4
0
        public void Verify_AreEqualExtension_CallsAreEqual()
        {
            // Arrange
            var mockMapper = new Mock <VolumeObjectMapper>();

            mockMapper.Setup(x => x.AreEqual(It.IsAny <IVolumeObjectModel>(), It.IsAny <IVolumeObject>()));
            VolumeObjectMapperExtensions.OverrideMapper(mockMapper.Object);
            var mockModel  = VolumeObjectsMockingSetup.DoMockingSetupForVolumeObjectModel(1);
            var mockEntity = VolumeObjectsMockingSetup.DoMockingSetupForVolumeObject(1);

            // Act
            mockModel.Object.AreEqual(mockEntity.Object);
            // Assert
            mockMapper.Verify(x => x.AreEqual(It.IsAny <IVolumeObjectModel>(), It.IsAny <IVolumeObject>()), Times.Once);
        }