Skip to content

Commit 309d0de

Browse files
committed
Fixed all the compilation errors left
Most of the errors were simple fix that could be made using simply conditional compilation flags.
1 parent 9010435 commit 309d0de

File tree

8 files changed

+54
-4
lines changed

8 files changed

+54
-4
lines changed

src/FluentAssertions.AspNetCore.Mvc/PartialViewResultAssertions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using FluentAssertions.Execution;
3-
using FluentAssertions.Mvc;
43
using FluentAssertions.Primitives;
54
using Microsoft.AspNetCore.Mvc;
65

src/FluentAssertions.Mvc.Shared/ActionResultAssertions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
using FluentAssertions.Primitives;
22
using FluentAssertions.Execution;
33
using System;
4+
#if NETSTANDARD1_6
5+
using Microsoft.AspNetCore.Mvc;
6+
#else
47
using System.Web.Mvc;
8+
#endif
59
using System.Diagnostics;
610

711
namespace FluentAssertions.Mvc

src/FluentAssertions.Mvc.Shared/AssertionsExtensions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
using FluentAssertions;
22
using System;
3+
#if NETSTANDARD1_6
4+
using Microsoft.AspNetCore.Mvc;
5+
using Microsoft.AspNetCore.Routing;
6+
#else
37
using System.Web.Mvc;
4-
using FluentAssertions.Mvc;
58
using System.Web.Routing;
9+
#endif
10+
using FluentAssertions.Mvc;
611
using System.Diagnostics;
712

813
namespace FluentAssertions.Mvc

src/FluentAssertions.Mvc.Shared/ContentResultAssertions.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using System.Text;
7+
#if NETSTANDARD1_6
8+
using Microsoft.AspNetCore.Mvc;
9+
#else
710
using System.Web.Mvc;
11+
#endif
812

913
namespace FluentAssertions.Mvc
1014
{
@@ -36,7 +40,11 @@ public ContentResultAssertions WithContent(string expectedContent, string reason
3640
string actualContent = (Subject as ContentResult).Content;
3741

3842
Execute.Assertion
43+
#if NETSTANDARD1_6
44+
.ForCondition(string.Equals(actualContent, expectedContent, StringComparison.OrdinalIgnoreCase))
45+
#else
3946
.ForCondition(string.Equals(actualContent, expectedContent, StringComparison.InvariantCultureIgnoreCase))
47+
#endif
4048
.BecauseOf(reason, reasonArgs)
4149
.FailWith(string.Format(FailureMessages.CommonFailMessage, "ContentResult.Content", expectedContent, actualContent));
4250

@@ -59,13 +67,19 @@ public ContentResultAssertions WithContentType(string expectedContentType, strin
5967
string actualContentType = (Subject as ContentResult).ContentType;
6068

6169
Execute.Assertion
70+
#if NETSTANDARD1_6
71+
.ForCondition(string.Equals(expectedContentType, actualContentType, StringComparison.OrdinalIgnoreCase))
72+
#else
6273
.ForCondition(string.Equals(expectedContentType, actualContentType, StringComparison.InvariantCultureIgnoreCase))
74+
#endif
6375
.BecauseOf(reason, reasonArgs)
6476
.FailWith(string.Format(FailureMessages.CommonFailMessage, "ContentResult.ContentType", expectedContentType, actualContentType));
6577

6678
return this;
6779
}
6880

81+
// ContentEncoding seems to have vanished from .NetCore... weird.
82+
#if !NETSTANDARD1_6
6983
/// <summary>
7084
/// Asserts that the content encoding is the expected content encoding type.
7185
/// </summary>
@@ -88,5 +102,6 @@ public ContentResultAssertions WithContentEncoding(Encoding expectedEncoding, st
88102

89103
return this;
90104
}
105+
#endif
91106
}
92107
}

src/FluentAssertions.Mvc.Shared/FailureMessages.Designer.cs

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/FluentAssertions.Mvc.Shared/RedirectResultAssertions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
#if NETSTANDARD1_6
6+
using Microsoft.AspNetCore.Mvc;
7+
#else
58
using System.Web.Mvc;
9+
#endif
610
using FluentAssertions.Execution;
711
using FluentAssertions.Primitives;
812

@@ -34,7 +38,11 @@ public RedirectResultAssertions WithUrl(string expectedUrl, string reason = "",
3438
string actualUrl = (Subject as RedirectResult).Url;
3539

3640
Execute.Assertion
41+
#if NETSTANDARD1_6
42+
.ForCondition(string.Equals(actualUrl, expectedUrl, StringComparison.OrdinalIgnoreCase))
43+
#else
3744
.ForCondition(string.Equals(actualUrl, expectedUrl, StringComparison.InvariantCultureIgnoreCase))
45+
#endif
3846
.BecauseOf(reason, reasonArgs)
3947
.FailWith("Expected RedirectResult.Url to be {0}{reason} but was {1}", expectedUrl, actualUrl);
4048

src/FluentAssertions.Mvc.Shared/RedirectToRouteAssertions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
using System.Text;
55
using FluentAssertions.Execution;
66
using FluentAssertions.Primitives;
7+
#if NETSTANDARD1_6
8+
using Microsoft.AspNetCore.Mvc;
9+
#else
710
using System.Web.Mvc;
11+
#endif
812
using FluentAssertions;
913

1014
namespace FluentAssertions.Mvc
@@ -57,7 +61,11 @@ public RedirectToRouteAssertions WithRouteName(string expectedRouteName, string
5761
{
5862
Execute.Assertion
5963
.BecauseOf(reason, reasonArgs)
64+
#if NETSTANDARD1_6
65+
.ForCondition(string.Equals(expectedRouteName, Subject.RouteName, StringComparison.OrdinalIgnoreCase))
66+
#else
6067
.ForCondition(string.Equals(expectedRouteName, Subject.RouteName, StringComparison.InvariantCultureIgnoreCase))
68+
#endif
6169
.FailWith("Expected RedirectToRoute.RouteName to be {0}{reason}, but found {1}", expectedRouteName, Subject.RouteName);
6270

6371
return this;

src/FluentAssertions.Mvc.Shared/RouteDataAssertions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
#if NETSTANDARD1_6
6+
using Microsoft.AspNetCore.Routing;
7+
#else
58
using System.Web.Routing;
9+
#endif
610
using FluentAssertions;
711
using FluentAssertions.Execution;
812
using FluentAssertions.Primitives;

0 commit comments

Comments
 (0)