My VM doesn't get populated with 'Confirm', its either a null or empty string (which I think is Umbracos default behaviour of GetValue). If I set the value on my page it maps just fine.
Saw there were a few tests for this (UmbracoMapper_MapFromIPublishedContent_MapsWithStringDefaultValueUsingAttribute) but I can't run the solution and offer a suggestion because 'Microsoft.QualityTools.Testing.Fakes' requires VS Premium/Ultimate I think!? I run Pro, so let me know if there's a way round this!
Looks like you're right - I've extended the tests you noted to check for empty string responses (rather than nulls, which works as expected) and they now fail. So have fixed and updated in the latest version if you pull from NuGet or Our. Thanks again for the testing and bug report.
As regard the unit tests, yes, unfortunately I've had to make use of MS Fakes here which, although a great solution, only comes with Premium (and fortunately, I get through work). I couldn't find another solution for mocking IPublishedContent. If you're interested, you can read how I came to his here. Not sure of a way around it - you can add your voice here for getting it in professional.
Cheers Andy and thanks for the links. Can't believe its not available to all versions with Microsofts/.NET's new 'open source' approach. Seems like a good approach though I've only really used Moq here and there in the past and your post clears a few things up I was wondering about.
Property Mapping - DefaultValue
Hi again,
Not sure if this is working, basic setup with matching property names... example:
[PropertyMapping(DefaultValue = "Confirm")]
public string ConfirmationButtonText { get; set; }
My VM doesn't get populated with 'Confirm', its either a null or empty string (which I think is Umbracos default behaviour of GetValue). If I set the value on my page it maps just fine.
Saw there were a few tests for this (UmbracoMapper_MapFromIPublishedContent_MapsWithStringDefaultValueUsingAttribute) but I can't run the solution and offer a suggestion because 'Microsoft.QualityTools.Testing.Fakes' requires VS Premium/Ultimate I think!? I run Pro, so let me know if there's a way round this!
Cheers,
Aaron.
Hi Aaron
Looks like you're right - I've extended the tests you noted to check for empty string responses (rather than nulls, which works as expected) and they now fail. So have fixed and updated in the latest version if you pull from NuGet or Our. Thanks again for the testing and bug report.
As regard the unit tests, yes, unfortunately I've had to make use of MS Fakes here which, although a great solution, only comes with Premium (and fortunately, I get through work). I couldn't find another solution for mocking IPublishedContent. If you're interested, you can read how I came to his here. Not sure of a way around it - you can add your voice here for getting it in professional.
Cheers
Andy
Cheers Andy and thanks for the links. Can't believe its not available to all versions with Microsofts/.NET's new 'open source' approach. Seems like a good approach though I've only really used Moq here and there in the past and your post clears a few things up I was wondering about.
Thanks,
Aaron.
is working on a reply...