This commit is contained in:
@@ -1570,7 +1570,6 @@ same as the server does but in a central location here for all tests to use.
|
|||||||
//This test is time zone sensitive and thus uses relative today
|
//This test is time zone sensitive and thus uses relative today
|
||||||
//If any other test are to fail this way they will need to be done the same way
|
//If any other test are to fail this way they will need to be done the same way
|
||||||
var WidgetNameStart = "DateTokenNextMonthFilterWorks";
|
var WidgetNameStart = "DateTokenNextMonthFilterWorks";
|
||||||
var RelativeToday = Util.RelativeToday();
|
|
||||||
|
|
||||||
long IncludedWidgetId = 0;
|
long IncludedWidgetId = 0;
|
||||||
long ExcludedWidgetId = 0;
|
long ExcludedWidgetId = 0;
|
||||||
@@ -1584,8 +1583,8 @@ same as the server does but in a central location here for all tests to use.
|
|||||||
w.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
w.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
||||||
|
|
||||||
//Put it right at midnight next month to ensure boundaries are respected
|
//Put it right at midnight next month to ensure boundaries are respected
|
||||||
w.startDate = new DateTime(RelativeToday.Year, RelativeToday.Month, 2, 00, 00, 00).AddMonths(1);
|
w.startDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 2, 00, 00, 00).AddMonths(1);
|
||||||
w.endDate = new DateTime(RelativeToday.Year, RelativeToday.Month, 2, 00, 00, 00).AddMonths(1).AddHours(1);
|
w.endDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 2, 00, 00, 00).AddMonths(1).AddHours(1);
|
||||||
|
|
||||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
@@ -1594,8 +1593,8 @@ same as the server does but in a central location here for all tests to use.
|
|||||||
//Excluded widget (Date range is within NEXT month from one second **before** the 1st to one hour later)
|
//Excluded widget (Date range is within NEXT month from one second **before** the 1st to one hour later)
|
||||||
w.name = Util.Uniquify(WidgetNameStart);
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
//First day of next month minus 1 second
|
//First day of next month minus 1 second
|
||||||
w.startDate = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, 00, 00, 00).AddMonths(1).AddSeconds(-1);
|
w.startDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 00, 00, 00).AddMonths(1).AddSeconds(-1);
|
||||||
w.endDate = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, 00, 00, 00).AddMonths(1).AddSeconds(-1).AddHours(1);
|
w.endDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1, 00, 00, 00).AddMonths(1).AddSeconds(-1).AddHours(1);
|
||||||
|
|
||||||
|
|
||||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
@@ -3384,6 +3383,27 @@ same as the server does but in a central location here for all tests to use.
|
|||||||
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
//NOW FETCH WIDGET LIST WITH FILTER
|
//NOW FETCH WIDGET LIST WITH FILTER
|
||||||
|
//-8 example
|
||||||
|
//" where (awidget.name Like 'DateTokenAprilFilterWorks%') AND (awidget.startdate >'2020-04-01T07:59:59.0000000' AND awidget.startdate <'2020-05-01T08:00:00.0000000')"
|
||||||
|
//"{\"data\":{\"id\":703,\"concurrencyToken\":7090259,\"name\":\"DateTokenAprilFilterWorks 1580754102534\",\"serial\":703,\"dollarAmount\":null,\"active\":null,\"roles\":0,
|
||||||
|
//\"startDate\":\"2020-04-01T07:00:00Z\",\"endDate\":\"2020-04-01T08:00:00Z\",\"notes\":\"blah\",\"count\":null,\"customFields\":\"{\\\"c1\\\":\\\"2019-02-08T06:31:48.0019809Z\\\",\\\"c2\\\":\\\"c2 text\\\",\\\"c3\\\":\\\"333\\\",\\\"c4\\\":\\\"true\\\",\\\"c5\\\":\\\"5.55\\\"}\",\"tags\":[],\"userId\":null}}"
|
||||||
|
//(awidget.startdate >'2020-04-01T07:59:59.0000000'
|
||||||
|
//Ok, here's the issue:
|
||||||
|
//This test is run when my local time is winter time or "standard time" which is -8utc
|
||||||
|
//this test creates a future record for April which will be in DST or "daylight saving time" which is -7utc because it uses a library method to convert to universal time
|
||||||
|
//which takes into account the date.
|
||||||
|
//In other words, test code is using conversions based on DST PST effective of the created date falls on
|
||||||
|
|
||||||
|
//At the server it's just blindly doing -8 because the user settings are at -8
|
||||||
|
|
||||||
|
//This means the server is filtering an april date using the forced -8 but the client is using the actual -7 so they are an hour out
|
||||||
|
//Fixes:
|
||||||
|
//Is it an issue? User is normally going to select specific dates and times regardless of time zone so this client code is actually a bit off when you think of it that way
|
||||||
|
//So test client should take into account user options setting rather than local date setting?
|
||||||
|
//Or, should server instead of having hard coded offset just have user's time zone and it in turn does the calcs properly
|
||||||
|
//so local users doesn't select an offset but rather a time zone and let .net handle all the conversions
|
||||||
|
//In future there won't be a daylight saving time in pacific time zone likely
|
||||||
|
|
||||||
a = await Util.GetAsync($"DataList/list?DataListKey=TestWidgetDataList&Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
a = await Util.GetAsync($"DataList/list?DataListKey=TestWidgetDataList&Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
Util.ValidateHTTPStatusCode(a, 200);
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|||||||
26
util.cs
26
util.cs
@@ -11,11 +11,11 @@ namespace raven_integration
|
|||||||
public static class Util
|
public static class Util
|
||||||
{
|
{
|
||||||
//#######################################################################################################
|
//#######################################################################################################
|
||||||
//public static string API_BASE_URL = "http://localhost:7575/api/v8/";
|
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\";
|
public static string TEST_DATA_FOLDER = @"..\..\..\testdata\";
|
||||||
|
|
||||||
public const decimal TIME_ZONE_ADJUSTMENT = -8;
|
// public const decimal TIME_ZONE_ADJUSTMENT = -8;
|
||||||
//#######################################################################################################
|
//#######################################################################################################
|
||||||
|
|
||||||
|
|
||||||
@@ -43,17 +43,17 @@ namespace raven_integration
|
|||||||
|
|
||||||
//DateTime stuff
|
//DateTime stuff
|
||||||
|
|
||||||
public static DateTime RelativeToday()
|
// public static DateTime RelativeToday()
|
||||||
{
|
// {
|
||||||
Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
|
// Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
|
||||||
return DateTime.Today.AddHours(TimeZoneAdjustment);
|
// return DateTime.Today.AddHours(TimeZoneAdjustment);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static DateTime RelativeNow()
|
// public static DateTime RelativeNow()
|
||||||
{
|
// {
|
||||||
Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
|
// Double TimeZoneAdjustment = ((double)TIME_ZONE_ADJUSTMENT) * -1;
|
||||||
return DateTime.Now.AddHours(TimeZoneAdjustment);
|
// return DateTime.Now.AddHours(TimeZoneAdjustment);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static string Uniquify(string s)
|
public static string Uniquify(string s)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user