This repository has been archived by the owner on Dec 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from leekelleher/hotfix-0.8.3
Custom PublishedContent property nullifies value
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
tests/Our.Umbraco.Ditto.Tests/CustomPublishedContentPropertyTests.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Our.Umbraco.Ditto.Tests | ||
{ | ||
using Mocks; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class CustomPublishedContentPropertyTests | ||
{ | ||
public class CustomPublishedContentMock : PublishedContentMock | ||
{ | ||
public string MyProperty { get; set; } | ||
} | ||
|
||
public class MyModel | ||
{ | ||
public string MyProperty { get; set; } | ||
} | ||
|
||
[Test] | ||
public void CustomPublishedContent_Property_IsMapped() | ||
{ | ||
var value = "myValue"; | ||
|
||
var property = new PublishedContentPropertyMock | ||
{ | ||
Alias = "myProperty", | ||
Value = value | ||
}; | ||
|
||
var content = new CustomPublishedContentMock | ||
{ | ||
Properties = new[] { property } | ||
}; | ||
|
||
var model = content.As<MyModel>(); | ||
|
||
Assert.That(model.MyProperty, Is.EqualTo(value)); | ||
} | ||
} | ||
} |
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