BasicAuthentication attribute and TimeSpan.ToShortString()
- BasicAuthenticationAttribute sets the HttpContext.User property when successfully validated. - Moved BasicAuthenticationAttribute from ActionFilter to IAsyncAuthorizationFilter. - TimeSpan.ToShortString() is now capable of negative values.
This commit is contained in:
@@ -203,14 +203,17 @@ namespace AMWD.Common.Tests.Extensions
|
||||
{
|
||||
// arrange
|
||||
var timeSpan = TimeSpan.Parse("1.10:11:12.345");
|
||||
var negativeTimeSpan = TimeSpan.FromDays(-1.234);
|
||||
|
||||
// act
|
||||
string shortString = timeSpan.ToShortString(withMilliseconds: false);
|
||||
string shortStringWithMillis = timeSpan.ToShortString(withMilliseconds: true);
|
||||
string shortStringNegative = negativeTimeSpan.ToShortString(withMilliseconds: true);
|
||||
|
||||
// assert
|
||||
Assert.AreEqual("1d 10h 11m 12s", shortString);
|
||||
Assert.AreEqual("1d 10h 11m 12s 345ms", shortStringWithMillis);
|
||||
Assert.AreEqual("-1d 5h 36m 57s 600ms", shortStringNegative);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in New Issue
Block a user