Created
September 10, 2010 21:16
-
-
Save JamesEggers1/574391 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
public class ObjectUnderTest | |
{ | |
private string _prefix; | |
public ObjectUnderTest(string prefix) | |
{ | |
_prefix = prefix; | |
} | |
public dto MapObject(obj input) | |
{ | |
AutoMapper.Mapper.CreateMap<obj, dto>() | |
.ForMember(x => x.name, y => _prefix + y.name); | |
} | |
} | |
public class TestClass | |
{ | |
public void Test1() | |
{ | |
var test = new ObjectUnderTest(null); | |
var testdto = test.MapObject(someTestObject); | |
} | |
public void Test2() | |
{ | |
var test = new ObjectUnderTest("Hello "); | |
var testdto = test.MapObject(someTestObject); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd run from that static method AutoMapper call. :)