I have quite a problem with creating tests for class that uses resources.
Outline of class:
class CardInfo
private readonly Dictionary<int, Card> Cards= new Dictionary<int, Card>
{
[(int)Card.Fireball] = new Card(CardCode.Fireball, ResourceService.MESSAGE_CARD_TITLE_FIREBALL, ResourceService.MESSAGE_CARD_DESCRIPTION_FIREBALL),
};
Method i'm trying to test:
public Card getCard(int CardCode) => Cards.ContainsKey(CardCode) ? Cards[CardCode] : new Card(CardCode.NOTSPECIFED, ResourceService.MESSAGE_INTERNAL_ERROR_TITLE_CARDNOTEXISTENT, ResourceService.MESSAGE_INTERNAL_ERROR_BODY_CARDNOTEXISTENT);
In test project i had tried:
[TestMethod]
public async Task getInternalServerResponseErrorUnknownTest()
{
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
() =>
{
cardService = new CardInfo();
});
currently error is thrown here, "ResourceMap not found"
in ResourceService:
public static string MESSAGE_CARD_TITLE_FIREBALL
{
get
{
return resourceLoader.GetString("MESSAGE_CARD_TITLE_FIREBALL");
}
}
How could i fix this?
Aucun commentaire:
Enregistrer un commentaire