public static void NoAttribute() { var assembly = Mocks.AssemblyInfo(); var proxy = new TestFrameworkProxy(assembly, null); Assert.IsType <XunitTestFramework>(proxy.InnerTestFramework); }
public void NoAttribute() { var assembly = Mocks.AssemblyInfo(); var proxy = new TestFrameworkProxy(assembly, null, diagnosticSpy); Assert.IsType <XunitTestFramework>(proxy.InnerTestFramework); Assert.Empty(diagnosticMessages); }
public static void Attribute_NoDiscoverer() { var attribute = Mocks.TestFrameworkAttribute(typeof(AttributeWithoutDiscoverer)); var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute }); var proxy = new TestFrameworkProxy(assembly, null); Assert.IsType <XunitTestFramework>(proxy.InnerTestFramework); }
public void Attribute_ThrowingTestFrameworkCtor() { var attribute = Mocks.TestFrameworkAttribute(typeof(AttributeWithThrowingTestFrameworkCtor)); var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute }); var proxy = new TestFrameworkProxy(assembly, null, diagnosticSpy); Assert.IsType <XunitTestFramework>(proxy.InnerTestFramework); AssertSingleDiagnosticMessage("Exception thrown during test framework construction: System.DivideByZeroException: Attempted to divide by zero."); }
public void Attribute_NoDiscoverer() { var attribute = Mocks.TestFrameworkAttribute(typeof(AttributeWithoutDiscoverer)); var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute }); var proxy = new TestFrameworkProxy(assembly, null, diagnosticSpy); Assert.IsType <XunitTestFramework>(proxy.InnerTestFramework); AssertSingleDiagnosticMessage("Assembly-level test framework attribute was not decorated with [TestFrameworkDiscoverer]"); }
public static void Attribute_WithDiscoverer() { var attribute = Mocks.TestFrameworkAttribute(typeof(AttributeWithDiscoverer)); var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute }); var sourceProvider = Substitute.For <ISourceInformationProvider>(); var proxy = new TestFrameworkProxy(assembly, sourceProvider); var testFramework = Assert.IsType <MyTestFramework>(proxy.InnerTestFramework); Assert.Same(sourceProvider, testFramework.SourceInformationProvider); }
public void Attribute_ThrowingDiscovererMethod() { Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; var attribute = Mocks.TestFrameworkAttribute(typeof(AttributeWithThrowingDiscovererMethod)); var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute }); var proxy = new TestFrameworkProxy(assembly, null, diagnosticSpy); Assert.IsType <XunitTestFramework>(proxy.InnerTestFramework); AssertSingleDiagnosticMessage("Exception thrown during test framework discoverer construction: System.DivideByZeroException: Attempted to divide by zero."); }
public void Attribute_WithDiscoverer_WithMessageSink() { var attribute = Mocks.TestFrameworkAttribute(typeof(AttributeWithDiscovererWithMessageSink)); var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute }); var sourceProvider = Substitute.For <ISourceInformationProvider>(); var proxy = new TestFrameworkProxy(assembly, sourceProvider, diagnosticSpy); var testFramework = Assert.IsType <MyTestFrameworkWithMessageSink>(proxy.InnerTestFramework); var wrapper = Assert.IsType <TestFrameworkProxy.MessageSinkWrapper>(testFramework.MessageSink); Assert.Same(diagnosticSpy, wrapper.InnerSink); Assert.Same(sourceProvider, testFramework.SourceInformationProvider); Assert.Empty(diagnosticMessages); }