S
Stick.Hello
Guest
I am new to C# UT.
I have static class (requirement are strict).
public static class MyClass
{
public static readonly Dictionary<int, int> MyDictionary;
static MyClass()
{
MyDictionary = new Dictionary<int, int>();
}
public static void init(string filePath) // external file path which has key value pair
{
// Fill the dictionary
}
public static int GetValue(int key)
{
int value = -1;
//some conditional logic and then
return MyDictionary.TryGetValue(key, value);
}
}
How to do the unit test for this class and dictionary.
Continue reading...
I have static class (requirement are strict).
public static class MyClass
{
public static readonly Dictionary<int, int> MyDictionary;
static MyClass()
{
MyDictionary = new Dictionary<int, int>();
}
public static void init(string filePath) // external file path which has key value pair
{
// Fill the dictionary
}
public static int GetValue(int key)
{
int value = -1;
//some conditional logic and then
return MyDictionary.TryGetValue(key, value);
}
}
How to do the unit test for this class and dictionary.
Continue reading...