Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Unit Testing LocalizationService.GetString via MemoryLocalizationService

$
0
0

Hello.

I'm trying to unit test the LocalizationService.GetString. I'm using the Moq framework to create mocks of a class with a method I want to test (the target).

the target method I am testing uses the following LocalizationService code:

LocalizationService.Current.GetStringByCulture("sampleKey", cultureInfo)

I've read that you can unit test this with the MemoryLocalizationService class. In my unit test class I have the following code:

var memoryLocalizationService = new MemoryLocalizationService();
memoryLocalizationService.AddString(cultureInfo, "sampleKey", "textIWantToReceive");

I don't know where to go from here and I'm not able to find any examples online. How do I setup the LocalizationService to receive the dictionary from MemoryLocalizationService?

Thanks.


Viewing all articles
Browse latest Browse all 9076

Trending Articles