public void AddToDictionaryShouldAddValueType() { const string ExpectedKey = "key"; const int ExpectedValue = 2; var dictionary = new Dictionary<string, int>(); var activity = new AddToDictionary<string, int>(); var host = new WorkflowInvokerTest(activity); dynamic input = new WorkflowArguments(); input.Dictionary = dictionary; input.Key = ExpectedKey; input.Value = ExpectedValue; try { host.TestActivity(input); Assert.AreEqual(1, dictionary.Count); Assert.AreEqual(ExpectedValue, dictionary[ExpectedKey]); } finally { host.Tracking.Trace(); } }
public void AddToNullDictionaryShouldThrow() { const string ExpectedKey = "key"; const string ExpectedValue = "value"; var activity = new AddToDictionary<string, string>(); var host = new WorkflowInvokerTest(activity); dynamic input = new WorkflowArguments(); input.Dictionary = null; input.Key = ExpectedKey; input.Value = ExpectedValue; try { AssertHelper.Throws<InvalidOperationException>(() => host.TestActivity(input)); } finally { host.Tracking.Trace(); } }