コード例 #1
0
        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();
            }
        }
コード例 #2
0
 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();
     }
 }