Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible solution for culture invariant tests using UseCultureAttribute #1005

Merged
merged 7 commits into from Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Tests/Shared.Specs/CollectionAssertionSpecs.cs
Expand Up @@ -1648,7 +1648,7 @@ public void When_asserting_collections_to_be_equal_but_expected_collection_is_nu
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare collection with <null>.*Parameter name: expectation");
"Cannot compare collection with <null>.*: expectation");
}

[Fact]
Expand Down Expand Up @@ -1974,7 +1974,7 @@ public void When_asserting_collections_not_to_be_equal_but_expected_collection_i
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare collection with <null>.*Parameter name: unexpected");
"Cannot compare collection with <null>.*: unexpected");
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion Tests/Shared.Specs/ExceptionAssertionSpecs.cs
Expand Up @@ -268,7 +268,7 @@ public void When_subject_throws_some_exception_with_message_which_contains_compl
// Assert
//-----------------------------------------------------------------------------------------------------------
ex.Message.Should().Match(
"Expected exception message to match the equivalent of*\"message2\", but*\"message2*Parameter name: someParam\"*");
"Expected exception message to match the equivalent of*\"message2\", but*\"message2*: someParam\"*");
}
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/Shared.Specs/GenericCollectionAssertionOfStringSpecs.cs
Expand Up @@ -825,7 +825,7 @@ public void When_asserting_collections_not_to_be_equal_but_expected_collection_i
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare collection with <null>.*Parameter name: unexpected");
"Cannot compare collection with <null>.*: unexpected");
}

[Fact]
Expand Down Expand Up @@ -895,7 +895,7 @@ public void When_asserting_collections_to_be_equal_but_expected_collection_is_nu
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare collection with <null>.*Parameter name: expectation");
"Cannot compare collection with <null>.*: expectation");
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions Tests/Shared.Specs/GenericDictionaryAssertionSpecs.cs
Expand Up @@ -1182,7 +1182,7 @@ public void When_asserting_dictionaries_to_be_equal_but_expected_dictionary_is_n
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare dictionary with <null>.*Parameter name: expected");
"Cannot compare dictionary with <null>.*: expected");
}

[Fact]
Expand Down Expand Up @@ -1367,7 +1367,7 @@ public void When_asserting_dictionaries_not_to_be_equal_but_expected_dictionary_
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare dictionary with <null>.*Parameter name: unexpected");
"Cannot compare dictionary with <null>.*: unexpected");
}

[Fact]
Expand Down Expand Up @@ -2509,7 +2509,7 @@ public void When_asserting_dictionary_contains_key_value_pairs_but_expected_key_
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare dictionary with <null>.*Parameter name: expected");
"Cannot compare dictionary with <null>.*: expected");
}

[Fact]
Expand Down Expand Up @@ -2585,7 +2585,7 @@ public void When_asserting_dictionary_does_not_contain_key_value_pairs_but_expec
// Assert
//-----------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentNullException>().WithMessage(
"Cannot compare dictionary with <null>.*Parameter name: items");
"Cannot compare dictionary with <null>.*: items");
}

[Fact]
Expand Down
9 changes: 4 additions & 5 deletions Tests/Shared.Specs/ObjectAssertionSpecs.cs
Expand Up @@ -1150,7 +1150,7 @@ public void When_an_object_is_not_binary_serializable_it_should_fail()
.Should().Throw<XunitException>()
.Where(ex =>
ex.Message.Contains("to be serializable because we need to store it on disk, but serialization failed with:") &&
ex.Message.Contains("marked as serializable"));
ex.Message.Contains(subject.GetType().FullName));
}

[Fact]
Expand All @@ -1177,7 +1177,7 @@ public void When_an_object_is_binary_serializable_but_not_deserializable_it_shou
.Should().Throw<XunitException>()
.Where(ex =>
ex.Message.Contains("to be serializable, but serialization failed with:") &&
ex.Message.Contains("constructor to deserialize"));
ex.Message.Contains(subject.GetType().FullName));
}

[Fact]
Expand Down Expand Up @@ -1336,7 +1336,7 @@ public void When_an_object_is_not_xml_serializable_it_should_fail()
.Should().Throw<XunitException>()
.Where(ex =>
ex.Message.Contains("to be serializable because we need to store it on disk, but serialization failed with:") &&
ex.Message.Contains("Only public types can be processed"));
ex.Message.Contains(subject.GetType().FullName));
}

[Fact]
Expand Down Expand Up @@ -1444,8 +1444,7 @@ public void When_an_object_is_not_data_contract_serializable_it_should_fail()
//-----------------------------------------------------------------------------------------------------------
act
.Should().Throw<XunitException>()
.Where(ex =>
ex.Message.Contains("Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute"));
.WithMessage("*we need to store it on disk*EnumMemberAttribute*");
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions Tests/Shared.Specs/TypeAssertionSpecs.cs
Expand Up @@ -777,7 +777,7 @@ public void When_asserting_a_type_is_derived_from_an_interface_it_fails_with_a_u
// Assert
//-------------------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentException>()
.WithMessage("Must not be an interface Type.*Parameter name: baseType");
.WithMessage("Must not be an interface Type.*: baseType");
}

[Fact]
Expand Down Expand Up @@ -930,7 +930,7 @@ public void When_asserting_a_type_is_not_derived_from_an_interface_it_fails_with
// Assert
//-------------------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentException>()
.WithMessage("Must not be an interface Type.*Parameter name: baseType");
.WithMessage("Must not be an interface Type.*: baseType");
}

[Fact]
Expand Down Expand Up @@ -2262,7 +2262,7 @@ public void When_asserting_a_type_implements_a_NonInterface_type_it_fails_with_a
// Assert
//-------------------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentException>()
.WithMessage("Must be an interface Type.*Parameter name: interfaceType");
.WithMessage("Must be an interface Type.*: interfaceType");
}

#endregion
Expand Down Expand Up @@ -2353,7 +2353,7 @@ public void When_asserting_a_type_does_not_implement_a_NonInterface_type_it_fail
// Assert
//-------------------------------------------------------------------------------------------------------------------
act.Should().Throw<ArgumentException>()
.WithMessage("Must be an interface Type.*Parameter name: interfaceType");
.WithMessage("Must be an interface Type.*: interfaceType");
}

#endregion
Expand Down