Exemplo n.º 1
0
        [FullTrustTest] // ISerializable types cannot be deserialized in medium trust.
        public void InvokeOperationParams_TestNullable()
        {
            InvokeOperation <bool> invoke   = null;
            TestProvider_Scenarios provider = new TestProvider_Scenarios(TestURIs.TestProvider_Scenarios);
            MixedType changedObj            = null;
            MixedType valuesObj             = null;

            LoadOperation lo = provider.Load(provider.GetMixedTypesQuery(), false);

            // wait for Load to complete, then invoke some domain methods
            EnqueueConditional(() => lo.IsComplete);

            EnqueueCallback(delegate
            {
                changedObj = provider.MixedTypes.Single(t => (t.ID == "MixedType_Max"));
                valuesObj  = provider.MixedTypes.Single(t => (t.ID == "MixedType_Other"));

                // invoke invoke operation
                invoke = provider.TestNullable_Online(changedObj, valuesObj.NullableBooleanProp, valuesObj.NullableByteProp, valuesObj.NullableSByteProp,
                                                      valuesObj.NullableInt16Prop, valuesObj.NullableUInt16Prop, valuesObj.NullableInt32Prop, valuesObj.NullableUInt32Prop,
                                                      valuesObj.NullableInt64Prop, valuesObj.NullableUInt64Prop, valuesObj.NullableCharProp, valuesObj.NullableDoubleProp,
                                                      valuesObj.NullableSingleProp, valuesObj.NullableDecimalProp, valuesObj.NullableDateTimeProp,
                                                      valuesObj.NullableTimeSpanProp, valuesObj.NullableGuidProp, valuesObj.NullableEnumProp,
                                                      valuesObj.NullableTimeSpanListProp, valuesObj.NullableDateTimeOffsetProp, TestHelperMethods.DefaultOperationAction, null);
            });

            EnqueueConditional(() => invoke.IsComplete);
            EnqueueCallback(delegate
            {
                // verify invocation completed succesfully
                Assert.IsNull(invoke.Error, "InvokeEventArgs.Error should be null");
                Assert.IsFalse(invoke.ValidationErrors.Any());

                Assert.IsTrue(invoke.Value);
            });

            EnqueueTestComplete();
        }