Skip to content

Commit

Permalink
cleanup and typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyrup committed Sep 27, 2018
1 parent fa354f8 commit 71d4d9b
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 34 deletions.
Expand Up @@ -79,7 +79,7 @@ internal static CSharpAccessModifier GetCSharpAccessModifier(this Type type)
return CSharpAccessModifier.Protected;
}

if (typeInfo.IsNestedAssembly || typeInfo.IsClass && typeInfo.IsNotPublic)
if (typeInfo.IsNestedAssembly || (typeInfo.IsClass && typeInfo.IsNotPublic))
{
return CSharpAccessModifier.Internal;
}
Expand Down
Expand Up @@ -58,7 +58,6 @@ public bool IsCyclicReference(ObjectReference reference)
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
///
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
Expand Down
1 change: 0 additions & 1 deletion Src/FluentAssertions/Execution/AssertionScope.cs
Expand Up @@ -237,7 +237,6 @@ public bool HasFailures()
return assertionStrategy.FailureMessages.Any();
}


/// <summary>
/// Gets data associated with the current scope and identified by <paramref name="key"/>.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion Src/FluentAssertions/Execution/ICloneable2.cs
Expand Up @@ -8,7 +8,6 @@ public interface ICloneable2
/// <summary>
/// Creates a new object that is a copy of the current instance.
/// </summary>
///
/// <returns>
/// A new object that is a copy of this instance.
/// </returns>
Expand Down
3 changes: 1 addition & 2 deletions Src/FluentAssertions/Primitives/StringEqualityValidator.cs
Expand Up @@ -38,9 +38,8 @@ protected override bool ValidateAgainstLengthDifferences()
"{0} with a length of {1}{reason}, but {2} has a length of {3}, differs near " + mismatchSegment + ".";
return new FailReason(message, expected, expected.Length, subject, subject.Length);
}
).SourceSucceeded; ;
).SourceSucceeded;
}

private string GetMismatchSegmentForStringsOfDifferentLengths()
Expand Down
2 changes: 1 addition & 1 deletion Tests/Shared.Specs/AsyncFunctionExceptionAssertionSpecs.cs
Expand Up @@ -4,7 +4,7 @@
using Xunit;
using Xunit.Sdk;

namespace FluentAssertions.Net45.Specs
namespace FluentAssertions.Specs
{
public class AsyncFunctionExceptionAssertionSpecs
{
Expand Down
30 changes: 15 additions & 15 deletions Tests/Shared.Specs/CollectionEquivalencySpecs.cs
Expand Up @@ -923,10 +923,10 @@ public void When_some_subject_items_are_not_equivalent_to_expectation_object_it_
// Act
//-----------------------------------------------------------------------------------------------------------
Action action = () => subject.Should().AllBeEquivalentTo(1);
////-----------------------------------------------------------------------------------------------------------
//// Assert
////-----------------------------------------------------------------------------------------------------------

//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
action.Should().Throw<XunitException>().WithMessage(
"Expected item[1] to be 1, but found 2.*Expected item[2] to be 1, but found 3*");
}
Expand All @@ -944,9 +944,9 @@ public void When_more_than_10_subjects_items_are_not_equivalent_to_expectation_o
//-----------------------------------------------------------------------------------------------------------
Action action = () => subject.Should().AllBeEquivalentTo(1);

////-----------------------------------------------------------------------------------------------------------
//// Assert
////-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
action.Should().Throw<XunitException>().Which
.Message.Should().Contain("item[9] to be 1, but found 2")
.And.NotContain("item[10]");
Expand All @@ -959,7 +959,7 @@ public void When_some_subject_items_are_not_equivalent_to_expectation_for_huge_t
// Arrange
//-----------------------------------------------------------------------------------------------------------
const int N = 100000;
var subject = new List<int>(N) {1};
var subject = new List<int>(N) { 1 };
for (int i = 1; i < N; i++)
{
subject.Add(2);
Expand All @@ -971,15 +971,15 @@ public void When_some_subject_items_are_not_equivalent_to_expectation_for_huge_t
Action action = () =>
{
try { subject.Should().AllBeEquivalentTo(1); }
catch (Exception)
catch
{
// ignored, we only care about execution time
}
};

////-----------------------------------------------------------------------------------------------------------
//// Assert
////-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
action.ExecutionTime().Should().BeLessThan(1.Seconds());
}

Expand Down Expand Up @@ -1508,9 +1508,9 @@ public void When_subject_is_empty_and_expectation_is_object_succeed()
//-----------------------------------------------------------------------------------------------------------
Action action = () => subject.Should().AllBeEquivalentTo('g');

////-----------------------------------------------------------------------------------------------------------
//// Assert
////-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
action.Should().NotThrow();
}

Expand Down
19 changes: 9 additions & 10 deletions Tests/Shared.Specs/ExtensibilitySpecs.cs
@@ -1,9 +1,8 @@
using System;
using FluentAssertions.Execution;
using Xunit;
using Xunit.Sdk;

namespace FluentAssertions.Net45.Specs
namespace FluentAssertions.Specs
{
public class ExtensibilitySpecs
{
Expand All @@ -13,7 +12,7 @@ public void When_a_method_is_marked_as_custom_assertion_it_should_be_ignored_dur
//-----------------------------------------------------------------------------------------------------------
// Arrange
//-----------------------------------------------------------------------------------------------------------
var myClient = new Customer
var myClient = new MyCustomer
{
Active = false
};
Expand All @@ -35,24 +34,24 @@ public void When_a_method_is_marked_as_custom_assertion_it_should_be_ignored_dur
}
}

public class Customer
public class MyCustomer
{
public bool Active { get; set; }
}

public static class CustomerExtensions
public static class MyCustomerExtensions
{
public static CustomerAssertions Should(this Customer customer)
public static MyCustomerAssertions Should(this MyCustomer customer)
{
return new CustomerAssertions(customer);
return new MyCustomerAssertions(customer);
}
}

public class CustomerAssertions
public class MyCustomerAssertions
{
private readonly Customer customer;
private readonly MyCustomer customer;

public CustomerAssertions(Customer customer)
public MyCustomerAssertions(MyCustomer customer)
{
this.customer = customer;
}
Expand Down
6 changes: 6 additions & 0 deletions Tests/Shared.Specs/NullableEnumAssertionSpecs.cs
Expand Up @@ -12,14 +12,20 @@ public class NullableEnumAssertionSpecs
[Fact]
public void When_a_nullable_enum_is_asserted_on_is_should_use_object_assertions()
{
//-----------------------------------------------------------------------------------------------------------
// Arrange
//-----------------------------------------------------------------------------------------------------------
MyEnum? myEnum = MyEnum.Dummy;
string expectedAssertionType = "FluentAssertions.Primitives.ObjectAssertions";

//-----------------------------------------------------------------------------------------------------------
// Act
//-----------------------------------------------------------------------------------------------------------
string assertionType = myEnum.Should().GetType().FullName;

//-----------------------------------------------------------------------------------------------------------
// Assert
//-----------------------------------------------------------------------------------------------------------
assertionType.Should().Be(expectedAssertionType,
"it is a breaking change, if nullable enums do not end up in ObjectAssertions");
}
Expand Down
4 changes: 2 additions & 2 deletions docs/_pages/documentation.md
Expand Up @@ -16,7 +16,7 @@ So although you are free to go through the many examples here, please consider t
## Supported Test Frameworks ##
Fluent Assertions supports a lot of different unit testing frameworks. Just add a reference to the corresponding test framework assembly to the unit test project. Fluent Assertions will automatically find the corresponding assembly and use it for throwing the framework-specific exceptions.

If, for some unknown reason, Fluent Assertions fails to find the assembly, and you're runnning under .NET 4.5 or a .NET Standard 2.0 project, try specifying the framework explicitly using a configuration setting in the project’s app.config. If it cannot find any of the supported frameworks, it will fall back to using a custom `AssertFailedException` exception class.
If, for some unknown reason, Fluent Assertions fails to find the assembly, and you're running under .NET 4.5 or a .NET Standard 2.0 project, try specifying the framework explicitly using a configuration setting in the project’s app.config. If it cannot find any of the supported frameworks, it will fall back to using a custom `AssertFailedException` exception class.

```xml
<configuration>
Expand Down Expand Up @@ -927,7 +927,7 @@ orderDto.Should().BeEquivalentTo(expectation, options => options.WithStrictOrder
**Notice:** For performance reasons, collections of bytes are compared in exact order.

### Diagnostics
`Should().BeEquivalentTo` is a very powerful feature, and one of the unique selling points of Fluent Assertions. But sometimes it can be a bit overwhelming, especially if some assertion fails under unexpected conditions. To help you understand how Fluent Assertions compared two (collections of) object graphs, the failure message will always include the relavant configuration settings:
`Should().BeEquivalentTo` is a very powerful feature, and one of the unique selling points of Fluent Assertions. But sometimes it can be a bit overwhelming, especially if some assertion fails under unexpected conditions. To help you understand how Fluent Assertions compared two (collections of) object graphs, the failure message will always include the relevant configuration settings:

```txt
Xunit.Sdk.XunitException
Expand Down

0 comments on commit 71d4d9b

Please sign in to comment.