Skip to content

Commit f2e7cf6

Browse files
committed
Fixed missing test run configurations and DateTimeOffset formats (#278)
1 parent abc2219 commit f2e7cf6

File tree

12 files changed

+72
-14
lines changed

12 files changed

+72
-14
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace MyTested.AspNetCore.Mvc.Utilities.Extensions
2+
{
3+
using System;
4+
5+
public static class DateTimeOffsetExtensions
6+
{
7+
public static string ToFormattedString(this DateTimeOffset? dateTimeOffset)
8+
=> dateTimeOffset?.ToString("r");
9+
}
10+
}

src/MyTested.AspNetCore.Mvc.Abstractions/Utilities/Extensions/EnumerableExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Collections.Generic;
55

66
/// <summary>
7-
/// Provides extension methods to IEnumerable.
7+
/// Provides extension methods to <see cref="IEnumerable{T}" />.
88
/// </summary>
99
public static class EnumerableExtensions
1010
{

src/MyTested.AspNetCore.Mvc.Caching/Builders/Data/MemoryCacheEntryTestBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public IMemoryCacheEntryDetailsTestBuilder<TValue> WithValueOfType<TValue>()
8484
if (expectedExpiration != actualExpiration)
8585
{
8686
this.ThrowNewDataProviderAssertionException(
87-
$"to have entry with '{this.MemoryCacheEntry.Key}' key and {expectedExpiration.GetErrorMessageName()} absolute expiration",
88-
$"in fact found {actualExpiration.GetErrorMessageName()}");
87+
$"to have entry with '{this.MemoryCacheEntry.Key}' key and {expectedExpiration.ToFormattedString().GetErrorMessageName()} absolute expiration",
88+
$"in fact found {actualExpiration.ToFormattedString().GetErrorMessageName()}");
8989
}
9090
});
9191

src/MyTested.AspNetCore.Mvc.Controllers.ActionResults/Builders/Authentication/AuthenticationPropertiesTestBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public IAndAuthenticationPropertiesTestBuilder WithExpiration(DateTimeOffset? ex
5656
if (expected.ExpiresUtc != actual.ExpiresUtc)
5757
{
5858
this.ThrowNewAuthenticationPropertiesAssertionException(
59-
expected.ExpiresUtc == null ? "not have expiration value" : $"have expiration value of {expected.ExpiresUtc.GetErrorMessageName()}",
60-
$"in fact found {actual.ExpiresUtc.GetErrorMessageName()}");
59+
expected.ExpiresUtc == null ? "not have expiration value" : $"have expiration value of {expected.ExpiresUtc.ToFormattedString().GetErrorMessageName()}",
60+
$"in fact found {actual.ExpiresUtc.ToFormattedString().GetErrorMessageName()}");
6161
}
6262
});
6363

@@ -90,8 +90,8 @@ public IAndAuthenticationPropertiesTestBuilder IssuedOn(DateTimeOffset? issuedOn
9090
if (expected.IssuedUtc != actual.IssuedUtc)
9191
{
9292
this.ThrowNewAuthenticationPropertiesAssertionException(
93-
expected.IssuedUtc == null ? "not have issued value" : $"have issued value of {expected.IssuedUtc.GetErrorMessageName()}",
94-
$"in fact found {actual.IssuedUtc.GetErrorMessageName()}");
93+
expected.IssuedUtc == null ? "not have issued value" : $"have issued value of {expected.IssuedUtc.ToFormattedString().GetErrorMessageName()}",
94+
$"in fact found {actual.IssuedUtc.ToFormattedString().GetErrorMessageName()}");
9595
}
9696
});
9797

test/MyTested.AspNetCore.Mvc.Caching.Test/BuildersTests/DataTests/MemoryCacheEntryTestBuilderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void WithAbsoluteExpirationShouldThrowExceptionWithInvorrectValue()
8989
.ShouldReturn()
9090
.Ok();
9191
},
92-
"When calling AddMemoryCacheAction action in MvcController expected memory cache to have entry with 'test' key and '2/1/2016 1:01:01 AM +00:00' absolute expiration, but in fact found '1/1/2016 1:01:01 AM +00:00'.");
92+
"When calling AddMemoryCacheAction action in MvcController expected memory cache to have entry with 'test' key and 'Mon, 01 Feb 2016 01:01:01 GMT' absolute expiration, but in fact found 'Fri, 01 Jan 2016 01:01:01 GMT'.");
9393
}
9494

9595
[Fact]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
using Xunit;
4+
5+
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Configuration.Test")]
6+
[assembly: ComVisible(false)]
7+
8+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

test/MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test/BuildersTests/AuthenticationTests/AuthenticationPropertiesTestBuilderTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void WithExpirationShouldThrowExceptionWithInvalidValue()
9898
.WithAuthenticationProperties(auth => auth
9999
.WithExpiration(new DateTimeOffset(new DateTime(2015, 1, 1, 1, 1, 1, DateTimeKind.Utc)))));
100100
},
101-
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to have expiration value of '1/1/2015 1:01:01 AM +00:00', but in fact found '1/1/2016 1:01:01 AM +00:00'.");
101+
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to have expiration value of 'Thu, 01 Jan 2015 01:01:01 GMT', but in fact found 'Fri, 01 Jan 2016 01:01:01 GMT'.");
102102
}
103103

104104
[Fact]
@@ -115,7 +115,7 @@ public void WithExpirationShouldThrowExceptionWithInvalidValueEmptyOriginal()
115115
.WithAuthenticationProperties(auth => auth
116116
.WithExpiration(new DateTimeOffset(new DateTime(2015, 1, 1, 1, 1, 1, DateTimeKind.Utc)))));
117117
},
118-
"When calling ChallengeWithEmptyAuthenticationProperties action in MvcController expected authentication properties to have expiration value of '1/1/2015 1:01:01 AM +00:00', but in fact found null.");
118+
"When calling ChallengeWithEmptyAuthenticationProperties action in MvcController expected authentication properties to have expiration value of 'Thu, 01 Jan 2015 01:01:01 GMT', but in fact found null.");
119119
}
120120

121121
[Fact]
@@ -132,7 +132,7 @@ public void WithExpirationShouldThrowExceptionWithInvalidValueNullValue()
132132
.WithAuthenticationProperties(auth => auth
133133
.WithExpiration(null)));
134134
},
135-
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to not have expiration value, but in fact found '1/1/2016 1:01:01 AM +00:00'.");
135+
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to not have expiration value, but in fact found 'Fri, 01 Jan 2016 01:01:01 GMT'.");
136136
}
137137

138138
[Fact]
@@ -190,7 +190,7 @@ public void WithIssuedShouldThrowExceptionWithInvalidValue()
190190
.WithAuthenticationProperties(auth => auth
191191
.IssuedOn(new DateTimeOffset(new DateTime(2014, 1, 1, 1, 1, 1, DateTimeKind.Utc)))));
192192
},
193-
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to have issued value of '1/1/2014 1:01:01 AM +00:00', but in fact found '1/1/2015 1:01:01 AM +00:00'.");
193+
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to have issued value of 'Wed, 01 Jan 2014 01:01:01 GMT', but in fact found 'Thu, 01 Jan 2015 01:01:01 GMT'.");
194194
}
195195

196196
[Fact]
@@ -207,7 +207,7 @@ public void WithIssuedShouldThrowExceptionWithInvalidValueEmptyOriginal()
207207
.WithAuthenticationProperties(auth => auth
208208
.IssuedOn(new DateTimeOffset(new DateTime(2014, 1, 1, 1, 1, 1, DateTimeKind.Utc)))));
209209
},
210-
"When calling ChallengeWithEmptyAuthenticationProperties action in MvcController expected authentication properties to have issued value of '1/1/2014 1:01:01 AM +00:00', but in fact found null.");
210+
"When calling ChallengeWithEmptyAuthenticationProperties action in MvcController expected authentication properties to have issued value of 'Wed, 01 Jan 2014 01:01:01 GMT', but in fact found null.");
211211
}
212212

213213
[Fact]
@@ -224,7 +224,7 @@ public void WithIssuedShouldThrowExceptionWithInvalidNullValue()
224224
.WithAuthenticationProperties(auth => auth
225225
.IssuedOn(null)));
226226
},
227-
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to not have issued value, but in fact found '1/1/2015 1:01:01 AM +00:00'.");
227+
"When calling ChallengeWithAuthenticationProperties action in MvcController expected authentication properties to not have issued value, but in fact found 'Thu, 01 Jan 2015 01:01:01 GMT'.");
228228
}
229229

230230
[Fact]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
using Xunit;
4+
5+
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Controllers.ActionResults.Test")]
6+
[assembly: ComVisible(false)]
7+
8+
[assembly: CollectionBehavior(DisableTestParallelization = true)]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
using Xunit;
4+
5+
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Controllers.Attributes.Test")]
6+
[assembly: ComVisible(false)]
7+
8+
[assembly: CollectionBehavior(DisableTestParallelization = true)]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
using Xunit;
4+
5+
[assembly: AssemblyProduct("MyTested.AspNetCore.Mvc.Controllers.Views.ActionResults.Test")]
6+
[assembly: ComVisible(false)]
7+
8+
[assembly: CollectionBehavior(DisableTestParallelization = true)]

0 commit comments

Comments
 (0)