I have a string resource that I'm using to set as the x:uid for a textblock
<data name="Expected.Text" xml:space="preserve">
<value>Expected Text</value>
</data>
<TextBlock x:Name="control" x:uid="Expected />
I'm trying to write a Unit test to check if the text is correct. However I can't get a handle on the "Expected" string because it has a .text at the end so that it can be displayed in the TextBlock
ResourceLoader loader = ResourceLoader.GetForCurrentView();
var expected = loader.GetString("Expected");
Assert.AreEqual(expected, control.Text);
This code fails because var expected is blank
You can access that property via the following notation:
var expected = loader.GetString("Expected/Text");
Source: https://docs.microsoft.com/en-us/windows/uwp/app-resources/localize-strings-ui-manifest#refer-to-a-string-resource-identifier-from-code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With