How would you check the parameters on a function that accepts a Dictionary?
IDictionary<string, string> someDictionary = new Dictionary<string, string> {
{"Key1", "Value1"},
{"Key2", "Value2"}
};
Expect.Call(delegate {someService.GetCodes(someDictionary);}).Constraints(...);
Basically, I want to verify that the parameter for GetCodes has the same values as the variable "someDictionary".
I forgot to mention that the method being tested builds the dictionary and passes that to the someService.GetCodes() method.
public void SomeOtherMethod() {
IDictionary<string, string> dict = new Dictionary<string, string> {
{"Key 1", "Value 1"},
{"Key 2", "Value 2"}
};
someService.GetCodes(dict); // This would pass!
IDictionary<string, string> dict2 = new Dictionary<string, string> {
{"Key 1", "Value 1a"},
{"Key 2a", "Value 2"}
};
someService.GetCodes(dict2); // This would fail!
}
so, I want to make sure the dictionary passed to the GetCodes method contain the same ones as the one specifed in the Expect.Call... method.
Another use case would be that maybe I just want to see if the keys of the dictionary contain "Key 1" and "Key 2", but don't care about the values... Or the othe rway around.