Beispiel #1
0
        public void TestPlatformIsSameArchitectureIsDifferent()
        {
            this.TestPurpose("Check that tests with SupportedPlatformAttribute will not run on the specified platform and different architecture.");
            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformLinux86),
                SupportedPlatform.Linux,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = Enumerable.Empty <ITestSettings>();

            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        public void TestDebuggerSupportedUnsupportedIsSame()
        {
            this.TestPurpose("Check that tests that specify the same debugger as supported and unsupported will not run with that debugger.");

            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_DebuggerGdbSupportedUnsupported),
                SupportedPlatform.Windows,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = Enumerable.Empty <ITestSettings>();

            Assert.Equal(expected, actual);
        }
Beispiel #3
0
        public void TestPlatformIsSameArchitectureIsSame()
        {
            this.TestPurpose("Check that tests with SupportedPlatformAttribute will run on the specified platform and architecture.");
            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformMac64),
                SupportedPlatform.MacOS,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = AttributionTests.ChangeName(
                AttributionTests.AllSettings,
                nameof(AttributionTests.MockTest_PlatformMac64));

            Assert.Equal(expected, actual);
        }
Beispiel #4
0
        public void TestDebuggerUnmatched()
        {
            this.TestPurpose("Check that tests that do not match the settings will not run.");

            IEnumerable <ITestSettings> settings = new ITestSettings[]
            {
                AttributionTests.Settings_ClangLldbX64,
                AttributionTests.Settings_ClangLldbX86
            };
            IEnumerable <ITestSettings> actual = settings.FilterSettings(
                AttributionTests.GetTestMethodInfo(nameof(AttributionTests.MockTest_DebuggerGdbSupported)),
                SupportedPlatform.Windows,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = Enumerable.Empty <ITestSettings>();

            Assert.Equal(expected, actual);
        }
Beispiel #5
0
        public void TestPlatformIsDifferent()
        {
            this.TestPurpose("Check that tests with SupportedPlatformAttribute will not run on a different platform.");
            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformWindows),
                SupportedPlatform.Linux,
                SupportedArchitecture.x86);
            IEnumerable <ITestSettings> expected = Enumerable.Empty <ITestSettings>();

            Assert.Equal(expected, actual);

            actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformWindows),
                SupportedPlatform.MacOS,
                SupportedArchitecture.x86);
            Assert.Equal(expected, actual);
        }
Beispiel #6
0
        public void TestDebuggerSupported()
        {
            this.TestPurpose("Check that tests with a single SupportedDebuggerAttribute will only run with the specified debugger.");

            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_DebuggerGdbSupported),
                SupportedPlatform.Windows,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = AttributionTests.ChangeName(
                new ITestSettings[]
            {
                AttributionTests.Settings_GppGdbX64,
                AttributionTests.Settings_GppGdbX86
            },
                nameof(AttributionTests.MockTest_DebuggerGdbSupported));

            Assert.Equal(expected, actual);
        }
Beispiel #7
0
        public void TestPlatformWithoutAttribute()
        {
            this.TestPurpose("Check that tests without SupportedPlatformAttribute will run with all test settings.");
            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformNeutral),
                SupportedPlatform.Windows,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = AttributionTests.ChangeName(
                AttributionTests.AllSettings,
                nameof(AttributionTests.MockTest_PlatformNeutral));

            Assert.Equal(expected, actual);

            actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformNeutral),
                SupportedPlatform.Windows,
                SupportedArchitecture.x86);
            Assert.Equal(expected, actual);

            actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformNeutral),
                SupportedPlatform.Linux,
                SupportedArchitecture.x64);
            Assert.Equal(expected, actual);

            actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformNeutral),
                SupportedPlatform.Linux,
                SupportedArchitecture.x86);
            Assert.Equal(expected, actual);

            actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformNeutral),
                SupportedPlatform.MacOS,
                SupportedArchitecture.x64);
            Assert.Equal(expected, actual);

            actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_PlatformNeutral),
                SupportedPlatform.MacOS,
                SupportedArchitecture.x86);
            Assert.Equal(expected, actual);
        }
Beispiel #8
0
        public void TestCompilerMultipleSupported()
        {
            this.TestPurpose("Check that tests with several SupportedCompilerAttribute will only run with the specified compilers.");

            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_CompilerGPlusPlus86ClangPlusPlus64Supported),
                SupportedPlatform.Windows,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = AttributionTests.ChangeName(
                new ITestSettings[]
            {
                AttributionTests.Settings_GppGdbX64,
                AttributionTests.Settings_CygwinGppGdbX64,
                AttributionTests.Settings_MingwGppGdbX64,
                AttributionTests.Settings_ClangLldbX86
            },
                nameof(AttributionTests.MockTest_CompilerGPlusPlus86ClangPlusPlus64Supported));

            Assert.Equal(expected, actual);
        }
Beispiel #9
0
        public void TestDebuggerMultipleUnsupported()
        {
            this.TestPurpose("Check that tests with multiple UnsupportedDebuggerAttribute will not run for the specified debuggers.");

            IEnumerable <ITestSettings> actual = AttributionTests.FilterSettings(
                nameof(AttributionTests.MockTest_DebuggerGdbLldbUnsupported),
                SupportedPlatform.Windows,
                SupportedArchitecture.x64);
            IEnumerable <ITestSettings> expected = AttributionTests.ChangeName(
                new ITestSettings[]
            {
                AttributionTests.Settings_GppGdbX64,
                AttributionTests.Settings_CygwinGppGdbX64,
                AttributionTests.Settings_CygwinGppGdbX86,
                AttributionTests.Settings_MingwGppGdbX86,
            },
                nameof(AttributionTests.MockTest_DebuggerGdbLldbUnsupported));

            Assert.Equal(expected, actual);
        }
Beispiel #10
0
        private static IEnumerable <ITestSettings> FilterSettings(string methodName, SupportedPlatform platform, SupportedArchitecture platformArchitecture)
        {
            MethodInfo methodInfo = AttributionTests.GetTestMethodInfo(methodName);

            return(AttributionTests.AllSettings.FilterSettings(methodInfo, platform, platformArchitecture));
        }