Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-cy committed Mar 12, 2022
1 parent a3d260a commit bb7ea6f
Show file tree
Hide file tree
Showing 8 changed files with 800 additions and 902 deletions.
12 changes: 12 additions & 0 deletions Src/FluentAssertions/AssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,18 @@ public static void Should<TAssertions>(this DateTimeOffsetAssertions<TAssertions
InvalidShouldCall();
}

#if NET6_0_OR_GREATER

/// <inheritdoc cref="Should(ExecutionTimeAssertions)" />
[Obsolete("You are asserting the 'AndConstraint' itself. Remove the 'Should()' method directly following 'And'", error: true)]
public static void Should<TAssertions>(this DateOnlyAssertions<TAssertions> _)
where TAssertions : DateOnlyAssertions<TAssertions>
{
InvalidShouldCall();
}

#endif

/// <summary>
/// You are asserting the <see cref="AndConstraint{T}"/> itself. Remove the <c>Should()</c> method directly following <c>And</c>.
/// </summary>
Expand Down
36 changes: 0 additions & 36 deletions Src/FluentAssertions/Extensions/FluentDateOnlyExtensions.cs

This file was deleted.

5 changes: 1 addition & 4 deletions Src/FluentAssertions/Formatting/DateOnlyValueFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ public bool CanHandle(object value)
public void Format(object value, FormattedObjectGraph formattedGraph, FormattingContext context, FormatChild formatChild)
{
var dateOnly = (DateOnly)value;

formattedGraph.AddFragment("<");
formattedGraph.AddFragment(dateOnly.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
formattedGraph.AddFragment(">");
formattedGraph.AddFragment(dateOnly.ToString("<yyyy-MM-dd>", CultureInfo.InvariantCulture));
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions Src/FluentAssertions/Primitives/DateOnlyAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ namespace FluentAssertions.Primitives
/// <summary>
/// Contains a number of methods to assert that a <see cref="DateOnly"/> is in the expected state.
/// </summary>
/// /// <remarks>
/// You can use the <see cref="FluentAssertions.Extensions.FluentDateOnlyExtensions"/>
/// for a more fluent way of specifying a <see cref="DateOnly"/>.
/// </remarks>
[DebuggerNonUserCode]
public class DateOnlyAssertions : DateOnlyAssertions<DateOnlyAssertions>
{
Expand All @@ -29,10 +25,6 @@ public DateOnlyAssertions(DateOnly? value)
/// <summary>
/// Contains a number of methods to assert that a <see cref="DateOnly"/> is in the expected state.
/// </summary>
/// /// <remarks>
/// You can use the <see cref="FluentAssertions.Extensions.FluentDateOnlyExtensions"/>
/// for a more fluent way of specifying a <see cref="DateOnly"/>.
/// </remarks>
[DebuggerNonUserCode]
public class DateOnlyAssertions<TAssertions>
where TAssertions : DateOnlyAssertions<TAssertions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ namespace FluentAssertions
public static FluentAssertions.Specialized.ActionAssertions Should(this System.Action action) { }
public static FluentAssertions.Collections.StringCollectionAssertions Should(this System.Collections.Generic.IEnumerable<string> @this) { }
public static FluentAssertions.Data.DataColumnAssertions Should(this System.Data.DataColumn actualValue) { }
public static FluentAssertions.Primitives.DateOnlyAssertions Should(this System.DateOnly actualValue) { }
public static FluentAssertions.Primitives.NullableDateOnlyAssertions Should(this System.DateOnly? actualValue) { }
public static FluentAssertions.Primitives.DateTimeAssertions Should(this System.DateTime actualValue) { }
public static FluentAssertions.Primitives.NullableDateTimeAssertions Should(this System.DateTime? actualValue) { }
public static FluentAssertions.Primitives.DateTimeOffsetAssertions Should(this System.DateTimeOffset actualValue) { }
Expand Down Expand Up @@ -110,6 +112,10 @@ namespace FluentAssertions
where TAssertions : FluentAssertions.Primitives.BooleanAssertions<TAssertions> { }
[System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" +
"ly following \'And\'", true)]
public static void Should<TAssertions>(this FluentAssertions.Primitives.DateOnlyAssertions<TAssertions> _)
where TAssertions : FluentAssertions.Primitives.DateOnlyAssertions<TAssertions> { }
[System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" +
"ly following \'And\'", true)]
public static void Should<TAssertions>(this FluentAssertions.Primitives.DateTimeAssertions<TAssertions> _)
where TAssertions : FluentAssertions.Primitives.DateTimeAssertions<TAssertions> { }
[System.Obsolete("You are asserting the \'AndConstraint\' itself. Remove the \'Should()\' method direct" +
Expand Down Expand Up @@ -1436,6 +1442,12 @@ namespace FluentAssertions.Formatting
public bool CanHandle(object value) { }
public void Format(object value, FluentAssertions.Formatting.FormattedObjectGraph formattedGraph, FluentAssertions.Formatting.FormattingContext context, FluentAssertions.Formatting.FormatChild formatChild) { }
}
public class DateOnlyValueFormatter : FluentAssertions.Formatting.IValueFormatter
{
public DateOnlyValueFormatter() { }
public bool CanHandle(object value) { }
public void Format(object value, FluentAssertions.Formatting.FormattedObjectGraph formattedGraph, FluentAssertions.Formatting.FormattingContext context, FluentAssertions.Formatting.FormatChild formatChild) { }
}
public class DateTimeOffsetValueFormatter : FluentAssertions.Formatting.IValueFormatter
{
public DateTimeOffsetValueFormatter() { }
Expand Down Expand Up @@ -1755,6 +1767,39 @@ namespace FluentAssertions.Primitives
public override bool Equals(object obj) { }
public FluentAssertions.AndConstraint<TAssertions> NotBe(bool unexpected, string because = "", params object[] becauseArgs) { }
}
public class DateOnlyAssertions : FluentAssertions.Primitives.DateOnlyAssertions<FluentAssertions.Primitives.DateOnlyAssertions>
{
public DateOnlyAssertions(System.DateOnly? value) { }
}
public class DateOnlyAssertions<TAssertions>
where TAssertions : FluentAssertions.Primitives.DateOnlyAssertions<TAssertions>
{
public DateOnlyAssertions(System.DateOnly? value) { }
public System.DateOnly? Subject { get; }
public FluentAssertions.AndConstraint<TAssertions> Be(System.DateOnly expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> Be(System.DateOnly? expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeAfter(System.DateOnly expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeBefore(System.DateOnly expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeOnOrAfter(System.DateOnly expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeOnOrBefore(System.DateOnly expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeOneOf(params System.DateOnly[] validValues) { }
public FluentAssertions.AndConstraint<TAssertions> BeOneOf(params System.Nullable<System.DateOnly>[] validValues) { }
public FluentAssertions.AndConstraint<TAssertions> BeOneOf(System.Collections.Generic.IEnumerable<System.DateOnly> validValues, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> BeOneOf(System.Collections.Generic.IEnumerable<System.DateOnly?> validValues, string because = "", params object[] becauseArgs) { }
public override bool Equals(object obj) { }
public FluentAssertions.AndConstraint<TAssertions> HaveDay(int expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveMonth(int expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveYear(int expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBe(System.DateOnly unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBe(System.DateOnly? unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBeAfter(System.DateOnly unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBeBefore(System.DateOnly unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBeOnOrAfter(System.DateOnly unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBeOnOrBefore(System.DateOnly unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveDay(int unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveMonth(int unexpected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveYear(int unexpected, string because = "", params object[] becauseArgs) { }
}
public class DateTimeAssertions : FluentAssertions.Primitives.DateTimeAssertions<FluentAssertions.Primitives.DateTimeAssertions>
{
public DateTimeAssertions(System.DateTime? value) { }
Expand Down Expand Up @@ -1956,6 +2001,19 @@ namespace FluentAssertions.Primitives
public FluentAssertions.AndConstraint<TAssertions> NotBeTrue(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveValue(string because = "", params object[] becauseArgs) { }
}
public class NullableDateOnlyAssertions : FluentAssertions.Primitives.NullableDateOnlyAssertions<FluentAssertions.Primitives.NullableDateOnlyAssertions>
{
public NullableDateOnlyAssertions(System.DateOnly? expected) { }
}
public class NullableDateOnlyAssertions<TAssertions> : FluentAssertions.Primitives.DateOnlyAssertions<TAssertions>
where TAssertions : FluentAssertions.Primitives.NullableDateOnlyAssertions<TAssertions>
{
public NullableDateOnlyAssertions(System.DateOnly? expected) { }
public FluentAssertions.AndConstraint<TAssertions> BeNull(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> HaveValue(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotBeNull(string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint<TAssertions> NotHaveValue(string because = "", params object[] becauseArgs) { }
}
public class NullableDateTimeAssertions : FluentAssertions.Primitives.NullableDateTimeAssertions<FluentAssertions.Primitives.NullableDateTimeAssertions>
{
public NullableDateTimeAssertions(System.DateTime? expected) { }
Expand Down
4 changes: 0 additions & 4 deletions Tests/FluentAssertions.Specs/AssertionExtensionsSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ private static bool OverridesEquals(Type t)
return equals is not null;
}

#if !NET6_0_OR_GREATER

[Fact]
public void Should_methods_have_a_matching_overload_to_guard_against_chaining_and_constraints()
{
Expand Down Expand Up @@ -66,8 +64,6 @@ public void Should_methods_have_a_matching_overload_to_guard_against_chaining_an
private static bool IsGuardOverload(MethodInfo m) =>
m.ReturnType == typeof(void) && m.IsDefined(typeof(ObsoleteAttribute));

#endif

private static Type GetMostParentType(Type type)
{
while (type.BaseType != typeof(object))
Expand Down

This file was deleted.

Loading

0 comments on commit bb7ea6f

Please sign in to comment.