ClassCleanup() public method

public ClassCleanup ( ) : void
return void
Ejemplo n.º 1
0
        public void WebSocketContainerHostTests()
        {
            int total  = 0;
            int passed = 0;

            foreach (var mi in typeof(ContainerHostTests).GetMethods())
            {
                if (mi.GetCustomAttributes(typeof(TestMethodAttribute), false).Length > 0 &&
                    mi.GetCustomAttributes(typeof(IgnoreAttribute), false).Length == 0)
                {
                    total++;

                    ContainerHostTests test = new ContainerHostTests();
                    test.Uri = new System.Uri(address);
                    test.ClassInitialize();

                    try
                    {
                        mi.Invoke(test, new object[0]);
                        System.Diagnostics.Trace.WriteLine(mi.Name + " passed");
                        passed++;
                    }
                    catch (Exception exception)
                    {
                        System.Diagnostics.Trace.WriteLine(mi.Name + " failed: " + exception.ToString());
                    }

                    test.ClassCleanup();
                }
            }

            Assert.AreEqual(total, passed, string.Format("Not all tests passed {0}/{1}", passed, total));
        }
Ejemplo n.º 2
0
        public void WebSocketContainerHostTests()
        {
            int total = 0;
            int passed = 0;
            string[] excluded = new string[]
            {
                "ContainerHostCustomTransportTest"
            };

            foreach (var mi in typeof(ContainerHostTests).GetMethods())
            {
                if (mi.GetCustomAttributes(typeof(TestMethodAttribute), false).Length > 0 &&
                    mi.GetCustomAttributes(typeof(IgnoreAttribute), false).Length == 0 &&
                    !excluded.Contains(mi.Name))
                {
                    total++;

                    ContainerHostTests test = new ContainerHostTests();
                    test.Uri = new System.Uri(address);
                    test.ClassInitialize();

                    try
                    {
                        mi.Invoke(test, new object[0]);
                        System.Diagnostics.Trace.WriteLine(mi.Name + " passed");
                        passed++;
                    }
                    catch (Exception exception)
                    {
                        System.Diagnostics.Trace.WriteLine(mi.Name + " failed: " + exception.ToString());
                    }

                    test.ClassCleanup();
                }
            }

            Assert.AreEqual(total, passed, string.Format("Not all tests passed {0}/{1}", passed, total));
        }