public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new IssueMapper(); var model = IssuesMockingSetup.DoMockingSetupForIssueModel(1); var entity = IssuesMockingSetup.DoMockingSetupForIssue(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToModelListingExtension_CallsMapToModel() { // Arrange var mockMapper = new Mock <IssueMapper>(); mockMapper.Setup(x => x.MapToModelListing(It.IsAny <IIssue>(), It.IsAny <int>())); var mockEntity = IssuesMockingSetup.DoMockingSetupForIssue(1); IssueMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockEntity.Object.MapToModelListing(); // Assert mockMapper.Verify(x => x.MapToModelListing(It.IsAny <IIssue>(), It.IsAny <int>()), Times.Once); }
public void Verify_AreEqualExtension_CallsAreEqual() { // Arrange var mockMapper = new Mock <IssueMapper>(); mockMapper.Setup(x => x.AreEqual(It.IsAny <IIssueModel>(), It.IsAny <IIssue>())); IssueMapperExtensions.OverrideMapper(mockMapper.Object); var mockModel = IssuesMockingSetup.DoMockingSetupForIssueModel(1); var mockEntity = IssuesMockingSetup.DoMockingSetupForIssue(1); // Act mockModel.Object.AreEqual(mockEntity.Object); // Assert mockMapper.Verify(x => x.AreEqual(It.IsAny <IIssueModel>(), It.IsAny <IIssue>()), Times.Once); }
public void Verify_MapToModelLite_AssignsLiteOnlyIssueProperties() { // Arrange var mapper = new IssueMapper(); var entity = IssuesMockingSetup.DoMockingSetupForIssue(); // Act var model = mapper.MapToModelLite(entity.Object); // Assert Assert.Equal(entity.Object.HasStaffReview, model.HasStaffReview); Assert.Equal(entity.Object.CoverDate, model.CoverDate); Assert.Equal(entity.Object.StoreDate, model.StoreDate); Assert.Equal(entity.Object.IssueNumber, model.IssueNumber); // Related Objects Assert.Equal(entity.Object.PrimaryImageFileId, model.PrimaryImageFileId); Assert.Equal(entity.Object.VolumeId, model.VolumeId); }