public void When_object_type_is_same_as_expected_type_but_in_different_assembly_it_should_fail_with_assembly_qualified_name() { // Arrange var typeFromOtherAssembly = new AssemblyA.ClassA().ReturnClassC(); // Act #pragma warning disable 436 // disable the warning on conflicting types, as this is the intention for the spec Action act = () => typeFromOtherAssembly.Should().BeOfType <AssemblyB.ClassC>(); #pragma warning restore 436 // Assert act.Should().Throw <XunitException>() .WithMessage("Expected type to be [AssemblyB.ClassC, FluentAssertions.Specs*], but found [AssemblyB.ClassC, AssemblyB*]."); }
public void When_type_is_equal_to_same_type_from_different_assembly_it_fails_with_assembly_qualified_name() { // Arrange #pragma warning disable 436 // disable the warning on conflicting types, as this is the intention for the spec Type typeFromThisAssembly = typeof(AssemblyB.ClassC); Type typeFromOtherAssembly = new AssemblyA.ClassA().ReturnClassC().GetType(); #pragma warning restore 436 // Act Action act = () => typeFromThisAssembly.Should().Be(typeFromOtherAssembly, "we want to test the failure {0}", "message"); // Assert act.Should().Throw <XunitException>() .WithMessage("Expected type to be [AssemblyB.ClassC, AssemblyB*] *failure message*, but found [AssemblyB.ClassC, FluentAssertions.Specs*]."); }