Example #1
0
        public void InvokeOperation_ReturnsIDictionary()
        {
            TestProvider_Scenarios   provider   = new TestProvider_Scenarios(TestURIs.TestProvider_Scenarios);
            Dictionary <string, int> dictionary = new Dictionary <string, int>();

            foreach (var i in new[] { 1, 2, 3 })
            {
                dictionary.Add(i.ToString(), i);
            }

            InvokeOperation invoke = provider.ReturnsDictionary(dictionary, TestHelperMethods.DefaultOperationAction, null);

            EnqueueConditional(() => invoke.IsComplete);
            EnqueueCallback(delegate
            {
                object returnValue = invoke.Value;
                Assert.IsNotNull(invoke.Value);

                Dictionary <string, int> returnValueAsDictonary = returnValue as Dictionary <string, int>;
                Assert.IsNotNull(returnValueAsDictonary);

                foreach (var kvp in dictionary)
                {
                    Assert.IsTrue(returnValueAsDictonary.ContainsKey(kvp.Key));
                    Assert.AreEqual(kvp.Value, returnValueAsDictonary[kvp.Key]);
                }
            });
            EnqueueTestComplete();
        }