68 lines
2.9 KiB
C#
68 lines
2.9 KiB
C#
using System;
|
|
using Xunit;
|
|
using Newtonsoft.Json.Linq;
|
|
using FluentAssertions;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using System.Collections.Concurrent;
|
|
namespace raven_integration
|
|
{
|
|
|
|
public class RequestedLocaleKeys
|
|
{
|
|
|
|
|
|
|
|
[Fact]
|
|
public async void RequestedLocaleKeysWorks()
|
|
{
|
|
//First determine if there is a requested key route because it's debug build dependent
|
|
//And doesn't exists if server was not debug built
|
|
ApiResponse a = await Util.GetAsync("BuildMode");
|
|
Util.ValidateDataReturnResponseOk(a);
|
|
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
|
BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" }));
|
|
|
|
if (BuildMode == "DEBUG")
|
|
{
|
|
|
|
//Make a "list" of keys to fetch the values for
|
|
List<string> keys = new List<string>();
|
|
keys.AddRange(new string[] { "HelpLicense", "ClientName" });
|
|
dynamic d = new JObject();
|
|
//d.localeId = 1;
|
|
d = JToken.FromObject(keys);
|
|
|
|
//Fetch the values to force RAVEN to track at least these two
|
|
a = await Util.PostAsync("Locale/subset", await Util.GetTokenAsync("ClientLimited"), d.ToString());
|
|
Util.ValidateDataReturnResponseOk(a);
|
|
Util.ValidateHTTPStatusCode(a, 200);
|
|
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
|
((JArray)a.ObjectResponse["data"]).Count.Should().Be(2);
|
|
|
|
//Now ensure there are at least two keys in the fetched keys array
|
|
a = await Util.GetAsync("Locale/LocaleKeyCoverage", await Util.GetTokenAsync("ClientLimited"));
|
|
Util.ValidateDataReturnResponseOk(a);
|
|
Util.ValidateHTTPStatusCode(a, 200);
|
|
|
|
var RequestedKeyCount = a.ObjectResponse["data"]["requestedKeyCount"].Value<int>();
|
|
RequestedKeyCount.Should().BeGreaterOrEqualTo(2);
|
|
var NotRequestedKeyCount = a.ObjectResponse["data"]["notRequestedKeyCount"].Value<int>();
|
|
NotRequestedKeyCount.Should().BeGreaterThan(1);//For now at least, once we have this dialed in it will be zero ultimately
|
|
|
|
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
|
((JArray)a.ObjectResponse["data"]["requestedKeys"]).Count.Should().Be(RequestedKeyCount);
|
|
((JArray)a.ObjectResponse["data"]["notRequestedKeys"]).Count.Should().Be(NotRequestedKeyCount);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==================================================
|
|
|
|
}//eoc
|
|
}//eons
|