Esempio n. 1
0
        void InitTestsTree()
        {

            Type t = typeof(Tests.TestSuite);

            foreach (MethodInfo mi in t.GetMethods())
            {
                object[] attributes = mi.GetCustomAttributes(typeof(Tests.TestAttribute), true);

                if (attributes.Length > 0)
                {
                    TestAttribute attribute = (TestAttribute)attributes[0];

                    TestInfo testInfo = new TestInfo();
                    testInfo.Method = mi;
                    testInfo.Name = attribute.Name;
                    testInfo.Group = attribute.Path;

                    _testInfos.Add(testInfo);

                }
            }

            foreach (TestInfo testInfo in _testInfos.OrderBy(ti => ti.Group).ThenBy(ti => ti.Name))
            {
                TreeNode groupNode = FindGroupNode(testInfo.Group);
                TreeNode node = groupNode.Nodes.Add(testInfo.Name);
                node.Tag = testInfo;
            }

        }
Esempio n. 2
0
 // Validate the post-resolved attribute.
 private void Validate(TestAttribute attribute, Type arg2)
 {
     if (attribute.Path == "error")
     {
         throw new InvalidOperationException(IndexErrorMsg);
     }
 }
        public void OpenTypeConverterWithOneGenericArg()
        {
            var cm = new ConverterManager();

            // Register a converter builder.
            // Builder runs once; converter runs each time.
            // Uses open type to match.
            // Also test the IEnumerable<OpenType> pattern.

            cm.AddConverter <OpenType, IEnumerable <OpenType>, Attribute>(typeof(TypeConverterWithOneGenericArg <>));

            var attr = new TestAttribute(null);
            {
                // Doesn't match since the OpenTypes would resolve to different Ts
                var converter = cm.GetSyncConverter <object, IEnumerable <int>, Attribute>();
                Assert.Null(converter);
            }
            {
                var converter = cm.GetSyncConverter <int, IEnumerable <int>, Attribute>();
                Assert.Equal(new int[] { 1, 1, 1 }, converter(1, attr, null));
            }

            {
                var converter = cm.GetSyncConverter <string, IEnumerable <string>, Attribute>();
                Assert.Equal(new string[] { "a", "a", "a" }, converter("a", attr, null));
            }
        }
Esempio n. 4
0
        private static Test NewTest(MethodInfo methodInfo, int count)
        {
            TestAttribute attr   = methodInfo.GetCustomAttribute <TestAttribute>();
            Action        action = () => methodInfo.Invoke(null, new object[] { count });

            return(NewTest(attr.Name, action));
        }
Esempio n. 5
0
 public TestClassSetup(
     TestClassSetupType setupType,
     TestAttribute setupMethodAttribute)
 {
     SetupType            = setupType;
     SetupMethodAttribute = setupMethodAttribute;
 }
    static void Main(string[] args)
    {
        TestClass     t = new TestClass(); // works
        TestAttribute a = typeof(Program).GetCustomAttributes(typeof(TestAttribute), false).Cast <TestAttribute>().First();

        a.TestMethod();     // works
    }
Esempio n. 7
0
        void LoadTests(Type t)
        {
            if (t.GetInterfaces().Contains(typeof(ITest)))
            {
                foreach (MethodInfo mi in t.GetMethods())
                {
                    object[] testAttributes = mi.GetCustomAttributes(typeof(TestAttribute), true);

                    if (testAttributes.Length > 0)
                    {
                        TestAttribute attribute = (TestAttribute)testAttributes[0];

                        TestInfo existing =
                            _testInfos.Where(ti => ti.Id == attribute.Id && ti.Category == attribute.Category).FirstOrDefault();

                        if (existing != null)
                        {
                            System.Diagnostics.Debug.WriteLine(string.Format("One more test with order {0} found {1}", attribute.Order, attribute.Name));

                            if (existing.Version > attribute.Version)
                            {
                                System.Diagnostics.Debug.WriteLine("Leave test already loaded");
                                continue;
                            }
                            else
                            {
                                System.Diagnostics.Debug.WriteLine("Reload newer test");
                                _testInfos.Remove(existing);
                            }
                        }

                        TestInfo testInfo = new TestInfo();
                        testInfo.Method           = mi;
                        testInfo.Name             = attribute.Name;
                        testInfo.Group            = attribute.Path;
                        testInfo.Order            = attribute.Order;
                        testInfo.ExecutionOrder   = attribute.ExecutionOrder;
                        testInfo.Id               = attribute.Id;
                        testInfo.Category         = attribute.Category;
                        testInfo.Version          = attribute.Version;
                        testInfo.RequirementLevel = attribute.RequirementLevel;
                        testInfo.RequiredFeatures.AddRange(attribute.RequiredFeatures);
                        testInfo.FunctionalityUnderTest.AddRange(attribute.FunctionalityUnderTest);

                        _testInfos.Add(testInfo);

                        if (attribute.ParametersTypes != null)
                        {
                            foreach (Type type in attribute.ParametersTypes)
                            {
                                if (!_settingsTypes.Contains(type))
                                {
                                    _settingsTypes.Add(type);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 8
0
            private Task <object> Builder(TestAttribute attrResolved, Type parameterType)
            {
                var method = parameterType.GetMethod("New", BindingFlags.Static | BindingFlags.Public);
                var obj    = method.Invoke(null, new object[] { attrResolved });

                return(Task.FromResult(obj));
            }
Esempio n. 9
0
        public void TestGetAttribute_NoAttributes()
        {
            MethodInfo    noAttr = this.GetType().GetMethod("NoAttributes");
            TestAttribute ta     = ReflectionUtils.GetAttribute <TestAttribute>(noAttr, false);

            Assert.IsNull(ta, "Wrong attribute returned");
        }
Esempio n. 10
0
        public void GetAttributeBuilderInfo_ReturnsExpectedAttribute()
        {
            var attribute = new TestAttribute("constructorSetAttributeValue")
            {
                BoolParameter               = true,
                StringParameter             = "stringParameterValue",
                IntParameter                = 42,
                DoesNotAutoResolveParameter = "doesNotAutoResolveParameterValue"
            };
            var builderInfo = ExtensionBinding.GetAttributeBuilderInfo(attribute);

            TestAttribute result = (TestAttribute)builderInfo.Constructor.Invoke(builderInfo.ConstructorArgs);

            Assert.Equal(attribute.ConstructorSetParameter, result.ConstructorSetParameter);

            // 6 properties on the object, but AppSetting will be null, so 5 will be expected.
            Assert.Equal(5, builderInfo.Properties.Count);

            var properties = builderInfo.Properties.ToDictionary(p => p.Key.Name, p => p.Value);

            Assert.Throws(typeof(KeyNotFoundException), () => properties["AppSettingSetParameter"]);
            Assert.Equal(attribute.BoolParameter, (bool)properties["BoolParameter"]);
            Assert.Equal(attribute.ConstructorSetParameter, (string)properties["ConstructorSetParameter"]);
            Assert.Equal(attribute.DoesNotAutoResolveParameter, (string)properties["DoesNotAutoResolveParameter"]);
            Assert.Equal(attribute.IntParameter, (int)properties["IntParameter"]);
            Assert.Equal(attribute.StringParameter, (string)properties["StringParameter"]);
        }
Esempio n. 11
0
        public void TestAttribute_WithArgs_NotRunnable()
        {
            var        method = GetMethod("MethodWithIntArgs");
            TestMethod test   = new TestAttribute().BuildFrom(method, null);

            Assert.That(test.RunState, Is.EqualTo(RunState.NotRunnable));
        }
Esempio n. 12
0
 public static void Main()
 {
     TestAttribute.Test();
     TestPoints.Test();
     TestGenericList.Test();
     TestMatrix.Test();
 }
Esempio n. 13
0
        public void IncludeTypes()
        {
            var someObj = new TestAttribute();

            Funcs.IncludeTypes(false, typeof(Object))(someObj, someObj.GetType()).Should().BeFalse();
            Funcs.IncludeTypes(true, typeof(Object))(someObj, someObj.GetType()).Should().BeTrue();
        }
        public void Equals_WhenAttributeObjectsAndValuesNotEqualButExcluded_MustReturnTrue()
        {
            // Arrange
            var testAttribute  = new TestAttribute();
            var testAttribute2 = new TestAttribute();
            var testClassA     = new TestClass
            {
                TestAttribute1 = testAttribute,
                TestValue1     = 1,
            };
            var testClassB = new TestClass
            {
                TestAttribute1 = testAttribute2,
                TestValue1     = 2,
            };
            var comparerExclusions = new List <IComparerExclusion>
            {
                new PropertyComparerExclusion <TestClass>(
                    x => x.TestAttribute1),
                new PropertyComparerExclusion <TestClass>(
                    x => x.TestValue1),
            };

            // Act
            var result = this.testCandidate.Equals(testClassA, testClassB, Array.Empty <IBaseAdditionalProcessing>(), comparerExclusions);

            // Assert
            result.Should().BeTrue();
        }
        public void TestAttribute_NoArgs_Runnable()
        {
            MethodInfo method = GetType().GetMethod("MethodWithoutArgs");
            TestMethod test   = new TestAttribute().BuildFrom(method, null);

            Assert.That(test.RunState, Is.EqualTo(RunState.Runnable));
        }
Esempio n. 16
0
        public void TestGetAttribute_AttributeExists()
        {
            MethodInfo    thisMethod = this.GetType().GetMethod("TestGetAttribute_AttributeExists");
            TestAttribute ta         = ReflectionUtils.GetAttribute <TestAttribute>(thisMethod, false);

            Assert.IsNotNull(ta, "No attribute returned");
            Assert.AreEqual("TestGetAttribute_AttributeExists", ta.Description, "Wrong attribute returned");
        }
Esempio n. 17
0
        public void TranslateUnknownAttribute()
        {
            var unknown = new TestAttribute();

            object attribute = OSPlatformTranslator.Translate(new[] { unknown }).Single();

            Assert.That(attribute, Is.SameAs(unknown));
        }
Esempio n. 18
0
        public void TrimsMultipleCategories()
        {
            TestAttribute ta = new TestAttribute();

            ta.Categories = "green , blue";
            Assert.Contains("green", ta._Categories.ToArray());
            Assert.Contains("blue", ta._Categories.ToArray());
        }
Esempio n. 19
0
        public void CategoriesIncludesCategoryProperty()
        {
            TestAttribute ta = new TestAttribute();

            ta.Categories = "Panda";
            Assert.True(ta._Categories.Contains("Panda"),
                        "Categories doesn't contain expected category 'Panda'.");
        }
        public void then_exception_is_thrown()
        {
            var callerWithoutResource = new TestAttribute();

            this.Invoking(_ =>
                          AssemblyResourceReader.ReadString(callerWithoutResource, "ResourceFile.txt"))
            .Should().Throw <Exception>();
        }
Esempio n. 21
0
 void w(TestAttribute s)
 {
     if (s == null)
     {
         Response.Write("null");
     }
     Response.Write(s + " " + "<br/>");
 }
Esempio n. 22
0
        void InitializeConfigurations()
        {
            _configurations = new List <ConfigurationFactory>();


            string location = Assembly.GetExecutingAssembly().Location;
            string path     = Path.GetDirectoryName(location);

            foreach (string file in Directory.GetFiles(path, "*.dll"))
            {
                try
                {
                    System.Reflection.Assembly assembly = Assembly.LoadFile(file);
                    if (assembly.GetCustomAttributes(
                            typeof(TestAssemblyAttribute),
                            false).Length > 0)
                    {
                        // Test assembly

                        foreach (Type t in assembly.GetTypes())
                        {
                            object[] attrs = t.GetCustomAttributes(typeof(TestClassAttribute), true);
                            if (attrs.Length > 0)
                            {
                                object initializer = Activator.CreateInstance(t);

                                foreach (MethodInfo mi in t.GetMethods())
                                {
                                    object[] testAttributes = mi.GetCustomAttributes(typeof(TestAttribute), true);

                                    if (testAttributes.Length > 0)
                                    {
                                        TestAttribute attribute = (TestAttribute)testAttributes[0];

                                        ConfigurationFactory factory = new ConfigurationFactory();
                                        factory.Id          = attribute.Id;
                                        factory.Name        = attribute.Name;
                                        factory.Path        = attribute.Path;
                                        factory.Method      = mi;
                                        factory.Initializer = initializer;

                                        _configurations.Add(factory);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception exc)
                {
                    View.ReportError(exc.Message);
                }
            }


            View.DisplayConfigurations(_configurations);
        }
Esempio n. 23
0
 private TestInfo(ITest test, TestAttribute infoAttribute)
 {
     Test             = test;
     Name             = infoAttribute.Name;
     Category         = infoAttribute.Category;
     Id               = infoAttribute.Id;
     Path             = infoAttribute.Path;
     FeatureUnderTest = infoAttribute.FeatureUnderTest;
 }
Esempio n. 24
0
        private static TestCaseAttribute ToTestCaseAttribute(TestAttribute testAttr)
        {
            var testCaseAttr = new TestCaseAttribute();

            testAttr.Author?.With(x => testCaseAttr.Author                 = x);
            testAttr.Description?.With(x => testCaseAttr.Description       = x);
            testAttr.ExpectedResult?.With(x => testCaseAttr.ExpectedResult = x);
            testAttr.TestOf?.With(x => testCaseAttr.TestOf                 = x);
            return(testCaseAttr);
        }
        public void TestTestAttribute()
        {
            TestAttribute test = new TestAttribute();

            Assert.IsNull(test.Description);
            test = new TestAttribute("Message");
            Assert.AreEqual("Message", test.Description);
            test.Description = "Message 2";
            Assert.AreEqual("Message 2", test.Description);
        }
Esempio n. 26
0
        public void OpenTypeArray()
        {
            var cm = new ConverterManager();

            cm.AddConverter <OpenType[], string, Attribute>(typeof(OpenArrayConverter <>));
            var attr = new TestAttribute(null);

            var converter = cm.GetConverter <int[], string, Attribute>();

            Assert.Equal("1,2,3", converter(new int[] { 1, 2, 3 }, attr, null));
        }
        public void ExecutionFilterAttribute_OnActionExecuting_CallsOnInValid_WhenValidateReturnsFalse()
        {
            bool called = false;
            var attr = new TestAttribute();
            attr.Invalid = () => called = true;
            attr.Validation = () => false;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was not called upon invalid validate");
        }
        public void ExecutionFilterAttribute_OnActionExecuting_DoesntCallOnInValid_WhenValidateReturnsTrue()
        {
            bool called = true;
            var attr = new TestAttribute();
            attr.Invalid = () => called = false;
            attr.Validation = () => true;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was called upon sucessful validation");
        }
        public void ClosedTypeArray()
        {
            var cm = new ConverterManager();

            cm.AddConverter <int[], string, Attribute>(new OpenArrayConverter <int>());
            var attr = new TestAttribute(null);

            var converter = cm.GetSyncConverter <int[], string, Attribute>();

            Assert.Equal("1,2,3", converter(new int[] { 1, 2, 3 }, attr, null));
        }
Esempio n. 30
0
        public void ExecutionFilterAttribute_OnActionExecuting_DoesntCallOnInValid_WhenValidateReturnsTrue()
        {
            bool called = true;
            var  attr   = new TestAttribute();

            attr.Invalid    = () => called = false;
            attr.Validation = () => true;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was called upon sucessful validation");
        }
Esempio n. 31
0
        public void ExecutionFilterAttribute_OnActionExecuting_CallsOnInValid_WhenValidateReturnsFalse()
        {
            bool called = false;
            var  attr   = new TestAttribute();

            attr.Invalid    = () => called = true;
            attr.Validation = () => false;

            attr.OnActionExecuting(FakeContext);

            Assert.True(called, "OnInvalid was not called upon invalid validate");
        }
Esempio n. 32
0
 public TestClass()
 {
     foreach (MethodInfo method in this.GetType().GetMethods())
     {
         if (TestAttribute.IsTest(method))
         {
             TestDelegate newDelegate = (TestDelagate)Delegate.CreateDelegate(typeof(TestDelagate), null, method);
             delegates.Add(newDelegate);
             //Invocation:
             newDelegate.DynamicInvoke(this, "hello");
         }
     }
 }
            private static bool Filter(TestAttribute attribute, Type parameterType)
            {
                Assert.Equal(typeof(string), parameterType); 

                // Validation example
                if (attribute.Path == "error")
                {
                    throw new InvalidOperationException(IndexErrorMsg);
                }
                if (attribute.Path == "false")
                {
                    return false;
                }
                return true;
            }
Esempio n. 34
0
 /// <summary>
 /// ValidateException method - provides the exception when a test fails
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actualError"></param>
 public static void ValidateException(TestAttribute expected, string actualError)
 {
     Console.WriteLine(actualError);
     string expectedError = string.Empty;
     if (expected == TestAttribute.Exception_TooManyResult)
     {
         expectedError = "TooManyResultsException";
     }
     if (expected == TestAttribute.Exception_AddExistingItem)
     {
         expectedError = "AddExistingItemException";
     }
     Assert.IsTrue(actualError.Contains(expectedError), "Expected: {0}, Actual: {1}", expectedError, actualError);
 }
Esempio n. 35
0
 /// <summary>
 /// ValidateLocation method - validate the locations based on the inputs
 /// </summary>
 /// <param name="actual"></param>
 /// <param name="expectedCount"></param>
 /// <param name="expectedValue"></param>
 /// <param name="attr"></param>
 /// <param name="isPartial"></param>
 public static void ValidateLocation(List<LocationDto> actual, int expectedCount, string expectedValue, TestAttribute attr, bool isPartial)
 {
     ValidateCount(expectedCount, actual.Count, TestAttribute.Subscriber);
     foreach (LocationDto loc in actual)
     {
         Assert.IsTrue(loc.ID != null, "No location found!");
         string actualValue = string.Empty;
         switch (attr)
         {
             case TestAttribute.AddressLine1:
                 actualValue = loc.AddressLine1;
                 break;
             case TestAttribute.AddressLine2:
                 actualValue = loc.AddressLine2;
                 break;
             case TestAttribute.City:
                 actualValue = loc.CityName;
                 break;
             case TestAttribute.State:
                 actualValue = loc.StateName;
                 break;
             case TestAttribute.Zip:
                 actualValue = loc.ZipCode;
                 break;
         }
         Validate(expectedValue, actualValue, attr.ToString(), isPartial);
     }
 }
Esempio n. 36
0
 /// <summary>
 /// ValidateService method - takes list of ServiceDto objects with TestAttribute enumeration
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 /// <param name="attr"></param>
 public static void ValidateService(List<ServiceDto> expected, List<ServiceDto> actual, TestAttribute attr)
 {
     if (expected == null)
     {
         return;
     }
     ValidateCount(expected.Count, actual.Count, attr);
     expected = expected.OrderBy(x => x.Name).ToList();
     actual = actual.OrderBy(x => x.Name).ToList();
     for (int i = 0; i < expected.Count; i++)
     {
         ValidateService(expected[i], actual[i]);
     }
 }
Esempio n. 37
0
 public void TrimsMultipleCategories() {
    TestAttribute ta = new TestAttribute();
    ta.Categories = "green , blue";
    Assert.Contains("green", ta._Categories.ToArray());
    Assert.Contains("blue", ta._Categories.ToArray());
 }
Esempio n. 38
0
 public void CategoriesIncludesCategoryProperty() {
    TestAttribute ta = new TestAttribute();
    ta.Categories = "Panda";
    Assert.True(ta._Categories.Contains("Panda"),
       "Categories doesn't contain expected category 'Panda'.");
 }
Esempio n. 39
0
 public void TestAttributeHasDefaultCategory() {
    TestAttribute ta = new TestAttribute();
    Assert.Equals(string.Empty, ta.Categories);
 }
Esempio n. 40
0
 /// <summary>
 /// ValidateSubscriber method - validate the subscribers based on the inputs
 /// </summary>
 /// <param name="actualSubscribs"></param>
 /// <param name="expectedCount"></param>
 /// <param name="expectedValue"></param>
 /// <param name="attr"></param>
 /// <param name="isPartial"></param>
 public static void ValidateSubscriber(List<SubscriberDto> actualSubscribs, int expectedCount, string expectedValue, TestAttribute attr, bool isPartial)
 {
     ValidateCount(expectedCount, actualSubscribs.Count, TestAttribute.Subscriber);
     foreach (var actual in actualSubscribs)
     {
         Assert.IsTrue(actual.ID != null, "No subscriber found!");
         LocationDto loc = actual.Accounts[0].Location;
         string actualValue = string.Empty;
         switch (attr)
         {
             case TestAttribute.AddressLine1:
                 actualValue = loc.AddressLine1;
                 break;
             case TestAttribute.AddressLine2:
                 actualValue = loc.AddressLine2;
                 break;
             case TestAttribute.City:
                 actualValue = loc.CityName;
                 break;
             case TestAttribute.State:
                 actualValue = loc.StateName;
                 break;
             case TestAttribute.Zip:
                 actualValue = loc.ZipCode;
                 break;
             case TestAttribute.FirstName:
             case TestAttribute.LastName:
             case TestAttribute.FullName:
             case TestAttribute.PartialName:
                 actualValue = actual.Name;
                 break;
         }
         Validate(expectedValue, actualValue, attr.ToString(), isPartial);
     }
 }
 private void LocalValidator(TestAttribute attribute, Type parameterType)
 {
     attribute.ValidateAtIndexTime(parameterType);
 }
Esempio n. 42
0
 /// <summary>
 /// ValidateError method - provides the error when a test fails
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 /// <param name="attr"></param>
 public static void ValidateError(string expected, string actual, TestAttribute attr)
 {
     ValidateError(expected, actual, attr.ToString());
 }
 private static void ValidateAtIndexTime(TestAttribute attribute, Type parameterType)
 {
     attribute.ValidateAtIndexTime(parameterType);
 }
        public void Extensibility_WithInvalidAttributePrefix()
        {
            TestAttribute attribute;
            XliffDocument document;
            IExtensible extensible;
            IExtension extension;
            Segment segment;
            Unit unit;

            attribute = new TestAttribute(ExtensibilityTests.Namespace1, "attribute1", "attribute 1");

            document = new XliffDocument("en-us");
            extensible = document;
            extension = new GenericExtension("extension");
            extensible.Extensions.Add(extension);
            extension.AddAttribute(attribute);

            document.Files.Add(new File("f1"));

            // Unit information.
            unit = new Unit("u1");
            document.Files[0].Containers.Add(unit);
            extensible = unit;

            // Segment information.
            segment = new Segment("s1");
            segment.Source = new Source();
            segment.State = TranslationState.Initial;
            unit.Resources.Add(segment);

            Console.WriteLine("Test with null prefix.");
            try
            {
                attribute.Prefix = null;
                TestUtilities.GetDocumentContents(document, "    ");
                Assert.Fail("Expected InvalidXmlSpecifierException to be thrown.");
            }
            catch (InvalidXmlSpecifierException e)
            {
                Assert.IsInstanceOfType(e.InnerException, typeof(ArgumentNullException), "Exception is incorrect.");
            }

            Console.WriteLine("Test with invalid prefix.");
            try
            {
                attribute.Prefix = "a:b";
                TestUtilities.GetDocumentContents(document, "    ");
                Assert.Fail("Expected InvalidXmlSpecifierException to be thrown.");
            }
            catch (InvalidXmlSpecifierException e)
            {
                Assert.IsInstanceOfType(e.InnerException, typeof(XmlException), "Exception is incorrect.");
            }

            Console.WriteLine("Test with null namespace.");
            try
            {
                attribute.Namespace = null;
                attribute.Prefix = ExtensibilityTests.Prefix1;
                TestUtilities.GetDocumentContents(document, "    ");
                Assert.Fail("Expected InvalidXmlSpecifierException to be thrown.");
            }
            catch (InvalidXmlSpecifierException e)
            {
                Assert.IsInstanceOfType(e.InnerException, typeof(ArgumentNullException), "Exception is incorrect.");
            }

            Console.WriteLine("Test with null local name.");
            try
            {
                attribute.Namespace = ExtensibilityTests.Namespace1;
                attribute.LocalName = null;
                TestUtilities.GetDocumentContents(document, "    ");
                Assert.Fail("Expected InvalidXmlSpecifierException to be thrown.");
            }
            catch (InvalidXmlSpecifierException e)
            {
                Assert.IsInstanceOfType(e.InnerException, typeof(ArgumentNullException), "Exception is incorrect.");
            }

            Console.WriteLine("Test with differing namespace.");
            try
            {
                attribute.Prefix = ExtensibilityTests.Prefix1;
                attribute.LocalName = "name";
                extension.AddAttribute(new TestAttribute(attribute.Prefix, "test", "attr2", "value"));

                TestUtilities.GetDocumentContents(document, "    ");
                Assert.Fail("Expected InvalidXmlSpecifierException to be thrown.");
            }
            catch (InvalidOperationException)
            {
            }
        }
 public void TestAttribute_WithArgs_NotRunnable()
 {
     MethodInfo method = GetType().GetMethod("MethodWithIntArgs");
     TestMethod test = new TestAttribute().BuildFrom(method, null);
     Assert.That(test.RunState, Is.EqualTo(RunState.NotRunnable));
 }
Esempio n. 46
0
 void w(TestAttribute s)
 {
     if (s == null) Response.Write("null");
     Response.Write(s + " " + "<br/>");
 }
Esempio n. 47
0
 /// <summary>
 /// Validate method - validate the inputs
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 /// <param name="attr"></param>
 public static void Validate(bool? expected, bool? actual, TestAttribute attr)
 {
     Validate(expected, actual, attr.ToString());
 }
Esempio n. 48
0
 /// <summary>
 /// ValidateCount method - validates the input counts
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 /// <param name="attr"></param>
 public static void ValidateCount(int expected, int actual, TestAttribute attr)
 {
     ValidateCount(expected, actual, attr.ToString());
 }
Esempio n. 49
0
 /// <summary>
 /// Validate method - validate the inputs
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 /// <param name="attr"></param>
 /// <param name="ignoreCase"></param>
 public static void Validate(string expected, string actual, TestAttribute attr, bool ignoreCase)
 {
     Validate(expected, actual, attr.ToString(), false, ignoreCase);
 }
Esempio n. 50
0
 public void TestAttribute_NoArgs_Runnable()
 {
     var method = GetMethod("MethodWithoutArgs");
     TestMethod test = new TestAttribute().BuildFrom(method, null);
     Assert.That(test.RunState, Is.EqualTo(RunState.Runnable));
 }
Esempio n. 51
0
 /// <summary>
 /// Validate method - validate the inputs
 /// </summary>
 /// <param name="expected"></param>
 /// <param name="actual"></param>
 /// <param name="attr"></param>
 public static void Validate(List<string> expected, List<string> actual, TestAttribute attr)
 {
     Validate(expected, actual, attr.ToString());
 }