Created
February 7, 2010 03:28
-
-
Save mneedham/297177 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void ShouldNotCopyTheId() | |
{ | |
Mapper.Reset(); | |
Mapper.CreateMap<Mark, Mark>(); | |
Mapper.CreateMap<Foo, Foo>().ForMember(foo => foo.Id, opts => opts.Ignore()); | |
var mark = new Mark { Foos = new List<Foo> { new Foo { Id = Guid.NewGuid()}}}; | |
var newMark = Mapper.Map<Mark, Mark>(mark); | |
Assert.That(newMark.Foos[0].Id, Is.EqualTo(Guid.Empty)); | |
} | |
public class Mark | |
{ | |
public List<Foo> Foos { get; set; } | |
} | |
public class Foo | |
{ | |
public Guid Id { get; set; } | |
} | |
NUnit.Framework.AssertionException: Expected: 00000000-0000-0000-0000-000000000000 | |
But was: b94fb309-5af8-4740-984f-602cf6308c89 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment