public void Verify_AreEqual_WithDifferentObjects_ReturnsFalse() { // Arrange var mapper = new CharacterIssueMapper(); var model = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssueModel(1); var entity = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssue(2); // Act var result = mapper.AreEqual(model.Object, entity.Object); // Assert Assert.False(result); }
public void Verify_MapToEntityExtension_CallsMapToEntity() { // Arrange var mockMapper = new Mock <CharacterIssueMapper>(); mockMapper.Setup(x => x.MapToEntity(It.IsAny <ICharacterIssueModel>(), It.IsAny <int>())); var mockModel = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssueModel(1); CharacterIssueMapperExtensions.OverrideMapper(mockMapper.Object); // Act mockModel.Object.MapToEntity(); // Assert mockMapper.Verify(x => x.MapToEntity(It.IsAny <ICharacterIssueModel>(), It.IsAny <int>()), Times.Once); }
public void Verify_MapToModelLite_AssignsLiteOnlyCharacterIssueProperties() { // Arrange var mapper = new CharacterIssueMapper(); var entity = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssue(); // Act var model = mapper.MapToModelLite(entity.Object); // Assert // <None> // Related Objects Assert.Equal(entity.Object.CharacterId, model.CharacterId); Assert.Equal(entity.Object.IssueId, model.IssueId); }
public void Verify_MapToEntity_AssignsCharacterIssueProperties() { // Arrange var mapper = new CharacterIssueMapper(); var model = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssueModel(); // Act var entity = mapper.MapToEntity(model.Object); // Assert // <None> // Related Objects Assert.Equal(model.Object.CharacterId, entity.CharacterId); Assert.Equal(model.Object.IssueId, entity.IssueId); // Associated Objects // <None> }
public void Verify_MapToSearchModel_AssignsCharacterIssueSearchProperties() { // Arrange var mapper = new CharacterIssueMapper(); var model = CharacterIssuesMockingSetup.DoMockingSetupForCharacterIssueModel(); // 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.IssueId, searchModel.IssueId); Assert.Equal(model.Object.Issue?.CustomKey, searchModel.IssueCustomKey); Assert.Equal(model.Object.Issue?.ApiDetailUrl, searchModel.IssueApiDetailUrl); Assert.Equal(model.Object.Issue?.SiteDetailUrl, searchModel.IssueSiteDetailUrl); Assert.Equal(model.Object.Issue?.Name, searchModel.IssueName); Assert.Equal(model.Object.Issue?.ShortDescription, searchModel.IssueShortDescription); Assert.Equal(model.Object.Issue?.Description, searchModel.IssueDescription); }