This commit is contained in:
2020-02-03 19:07:48 +00:00
parent 6c36a2f470
commit 694e2e1284
2 changed files with 51 additions and 45 deletions

50
util.cs
View File

@@ -8,17 +8,28 @@ using System.Collections.Concurrent;
namespace raven_integration
{
public static class TimeZoneAdjustmentExtension
{
public static DateTime ToOffsetAdjustedUniversalTime(this DateTime dtIn)
{
//Date filtering tests MUST use a relative time zone adjusted to users's forced user options time zone
//or the tests that cross dst / pst boundaries will fail
//See servers spec doc core-locale-currency-numbers-time-and-dates.txt for details
double TIME_ZONE_ADJUSTMENT = -8;
Double TimeZoneAdjustment = (TIME_ZONE_ADJUSTMENT) * -1;
return dtIn.AddHours(TimeZoneAdjustment).ToUniversalTime();
}
}
public static class Util
{
//#######################################################################################################
public static string API_BASE_URL = "http://localhost:7575/api/v8/";
// public static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/";
// public static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/";
public static string TEST_DATA_FOLDER = @"..\..\..\testdata\";
//Date filtering tests MUST use a relative time zone adjusted to users's forced user options time zone
//or the tests that cross dst / pst boundaries will fail
//See servers spec doc core-locale-currency-numbers-time-and-dates.txt for details
public const decimal TIME_ZONE_ADJUSTMENT = -8;
//#######################################################################################################
@@ -44,19 +55,26 @@ namespace raven_integration
private static AutoId Auto { get; } = new AutoId(0);
//DateTime stuff
//DateTime adjustment methods for relative date filter testing
// public static DateTime RelativeToday()
// {
// Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
// return DateTime.Today.AddHours(TimeZoneAdjustment);
// }
// public static DateTime RelativeNow()
// {
// Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
// return DateTime.Now.AddHours(TimeZoneAdjustment);
// }
// public static DateTime ToOffsetAdjustedUniversalTime(DateTime dtIn)
// {
// Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
// return dtIn.AddHours(TimeZoneAdjustment).ToUniversalTime();
// }
public static DateTime RelativeToday()
{
Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
return DateTime.Today.AddHours(TimeZoneAdjustment);
}
public static DateTime RelativeNow()
{
Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
return DateTime.Now.AddHours(TimeZoneAdjustment);
}
public static string Uniquify(string s)
{