Skip to content

Instantly share code, notes, and snippets.

@JamesEggers1
Created September 10, 2010 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JamesEggers1/574391 to your computer and use it in GitHub Desktop.
Save JamesEggers1/574391 to your computer and use it in GitHub Desktop.
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);
}
}
@darrencauthon
Copy link

I'd run from that static method AutoMapper call. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment