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

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

            object result = testSubject.ExecuteCreateBehavior();
        }
Exemplo 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);
        }
Exemplo 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);
        }