Esempio n. 1
0
        public void SchemaValidationBehaviorExtensionElement_CreateBehavior_EmptyResource()
        {
            SchemaValidationBehaviorExtensionElementTestWrapper testSubject = new SchemaValidationBehaviorExtensionElementTestWrapper();

            testSubject.Enabled    = true;
            testSubject.SchemaFile = string.Empty;

            object result = testSubject.ExecuteCreateBehavior();
        }
Esempio n. 2
0
        public void SchemaValidationBehaviorExtensionElement_CreateBehavior_Disabled()
        {
            SchemaValidationBehaviorExtensionElementTestWrapper testSubject = new SchemaValidationBehaviorExtensionElementTestWrapper();

            testSubject.Enabled = false;
            /* Since the behavior will be disabled, passing an non-existing file should not matter */
            testSubject.SchemaFile = @"SchemaValidationBehaviorExtensionElement\CreateBehavior_Disabled\UnknownContract.xsd";

            object result = testSubject.ExecuteCreateBehavior();

            Assert.IsInstanceOfType(result, typeof(SchemaValidationBehavior));
            SchemaValidationBehavior castedResult = result as SchemaValidationBehavior;

            Assert.IsFalse(castedResult.Enabled);
        }
Esempio n. 3
0
        public void SchemaValidationBehaviorExtensionElement_CreateBehavior_ValidResource()
        {
            SchemaValidationBehaviorExtensionElementTestWrapper testSubject = new SchemaValidationBehaviorExtensionElementTestWrapper();

            testSubject.Enabled    = true;
            testSubject.SchemaFile = @"resource://Enkoni.Framework.ServiceModel.Tests.TestDataContract.xsd, Enkoni.Framework.ServiceModel.Tests";

            object result = testSubject.ExecuteCreateBehavior();

            Assert.IsInstanceOfType(result, typeof(SchemaValidationBehavior));
            SchemaValidationBehavior castedResult = result as SchemaValidationBehavior;

            Assert.IsTrue(castedResult.Enabled);

            PrivateObject privateObjectResult = new PrivateObject(castedResult, "schemaSet");
            XmlSchemaSet  schemaSet           = privateObjectResult.Target as XmlSchemaSet;

            Assert.IsNotNull(schemaSet);
        }