public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new ObjectVolumeMapper(); var model = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolumeModel(1); var entity = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolume(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToEntityExtension_CallsMapToEntity() { // Arrange var mockMapper = new Mock <ObjectVolumeMapper>(); mockMapper.Setup(x => x.MapToEntity(It.IsAny <IObjectVolumeModel>(), It.IsAny <int>())); var mockModel = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolumeModel(1); ObjectVolumeMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockModel.Object.MapToEntity(); // Assert mockMapper.Verify(x => x.MapToEntity(It.IsAny <IObjectVolumeModel>(), It.IsAny <int>()), Times.Once); }
public void Verify_AreEqualExtension_CallsAreEqual() { // Arrange var mockMapper = new Mock <ObjectVolumeMapper>(); mockMapper.Setup(x => x.AreEqual(It.IsAny <IObjectVolumeModel>(), It.IsAny <IObjectVolume>())); ObjectVolumeMapperExtensions.OverrideMapper(mockMapper.Object); var mockModel = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolumeModel(1); var mockEntity = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolume(1); // Act mockModel.Object.AreEqual(mockEntity.Object); // Assert mockMapper.Verify(x => x.AreEqual(It.IsAny <IObjectVolumeModel>(), It.IsAny <IObjectVolume>()), Times.Once); }
public void Verify_MapToEntity_AssignsObjectVolumeProperties() { // Arrange var mapper = new ObjectVolumeMapper(); var model = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolumeModel(); // Act var entity = mapper.MapToEntity(model.Object); // Assert // <None> // Related Objects Assert.Equal(model.Object.ObjectId, entity.ObjectId); Assert.Equal(model.Object.VolumeId, entity.VolumeId); // Associated Objects // <None> }
public void Verify_MapToSearchModel_AssignsObjectVolumeSearchProperties() { // Arrange var mapper = new ObjectVolumeMapper(); var model = ObjectVolumesMockingSetup.DoMockingSetupForObjectVolumeModel(); // Act var searchModel = mapper.MapToSearchModel(model.Object); // Assert Assert.Equal(model.Object.ObjectId, searchModel.ObjectId); Assert.Equal(model.Object.Object?.CustomKey, searchModel.ObjectCustomKey); Assert.Equal(model.Object.Object?.ApiDetailUrl, searchModel.ObjectApiDetailUrl); Assert.Equal(model.Object.Object?.SiteDetailUrl, searchModel.ObjectSiteDetailUrl); Assert.Equal(model.Object.Object?.Name, searchModel.ObjectName); Assert.Equal(model.Object.Object?.ShortDescription, searchModel.ObjectShortDescription); Assert.Equal(model.Object.Object?.Description, searchModel.ObjectDescription); Assert.Equal(model.Object.VolumeId, searchModel.VolumeId); Assert.Equal(model.Object.Volume?.CustomKey, searchModel.VolumeCustomKey); Assert.Equal(model.Object.Volume?.ApiDetailUrl, searchModel.VolumeApiDetailUrl); Assert.Equal(model.Object.Volume?.SiteDetailUrl, searchModel.VolumeSiteDetailUrl); Assert.Equal(model.Object.Volume?.Name, searchModel.VolumeName); Assert.Equal(model.Object.Volume?.ShortDescription, searchModel.VolumeShortDescription); Assert.Equal(model.Object.Volume?.Description, searchModel.VolumeDescription); }