Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 03bb422

Browse files
committed
Add AutoMapping method test
1 parent 54cab5b commit 03bb422

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/ServiceStack.Text.Tests/AutoMappingTests.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,5 +1563,34 @@ public void Does_convert_nested_collections()
15631563
Assert.That(navItems[0].Children[1].Id, Is.EqualTo("B2"));
15641564
Assert.That(navItems[0].Children[1].Children[0].Id, Is.EqualTo("C1"));
15651565
}
1566+
1567+
public class TestMethod
1568+
{
1569+
public void MyMethod(string myProp)
1570+
{
1571+
MyProp = myProp;
1572+
}
1573+
public string MyProp { get; set; }
1574+
}
1575+
1576+
public class TestMethod2
1577+
{
1578+
public void MyMethod()
1579+
{
1580+
MyProp = nameof(MyMethod);
1581+
}
1582+
public string MyProp { get; set; }
1583+
}
1584+
1585+
[Test]
1586+
public void Does_not_try_to_map_methods()
1587+
{
1588+
var from = new TestMethod();
1589+
var to = new TestMethod2();
1590+
from.MyProp = "Test";
1591+
to.PopulateFromPropertiesWithoutAttribute(from, typeof(IgnoreDataMemberAttribute));
1592+
Assert.That(from.MyProp, Is.EqualTo(to.MyProp));
1593+
}
1594+
15661595
}
15671596
}

0 commit comments

Comments
 (0)