コード例 #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();
        }
コード例 #2
0
        [FullTrustTest] // ISerializable types cannot be deserialized in medium trust.
        public void InvokeOperationParams_TestPrimitive()
        {
            TestProvider_Scenarios provider = new TestProvider_Scenarios(TestURIs.TestProvider_Scenarios);
            MixedType changedObj            = null;
            MixedType valuesObj             = null;
            InvokeOperation <bool> invoke   = 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.TestPrimitive_Online(changedObj, valuesObj.BooleanProp, valuesObj.ByteProp, valuesObj.SByteProp,
                                                       valuesObj.Int16Prop, valuesObj.UInt16Prop, valuesObj.Int32Prop, valuesObj.UInt32Prop, valuesObj.Int64Prop,
                                                       valuesObj.UInt64Prop, valuesObj.CharProp, valuesObj.DoubleProp, valuesObj.SingleProp, TestHelperMethods.DefaultOperationAction, null);
            });

            EnqueueConditional(() => invoke.IsComplete);
            EnqueueCallback(delegate
            {
                // verify invocation completed succesfully
                Assert.IsNull(invoke.Error);
                Assert.IsFalse(invoke.ValidationErrors.Any());

                Assert.IsTrue(invoke.Value);

                // verify the entity we passed as the invoke operation param is not changed on the client
                Assert.AreEqual(255, changedObj.ByteProp);
            });

            EnqueueTestComplete();
        }
コード例 #3
0
        [FullTrustTest] // ISerializable types cannot be deserialized in medium trust.
        public void InvokeOperationParams_TestPredefined()
        {
            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.TestPredefined_Online(changedObj, valuesObj.StringProp, valuesObj.DecimalProp,
                                                        valuesObj.DateTimeProp, valuesObj.TimeSpanProp, valuesObj.StringsProp, valuesObj.UriProp,
                                                        valuesObj.GuidProp, valuesObj.BinaryProp, valuesObj.XElementProp, valuesObj.ByteArrayProp,
                                                        valuesObj.EnumProp, valuesObj.GuidsProp, valuesObj.UInt64sProp, valuesObj.DateTimeOffsetProp, TestHelperMethods.DefaultOperationAction, null);
            });

            EnqueueConditional(() => invoke.IsComplete);
            EnqueueCallback(delegate
            {
                // verify invocation completed succesfully
                Assert.IsNull(invoke.Error);
                Assert.IsFalse(invoke.ValidationErrors.Any());

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

            EnqueueTestComplete();
        }