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 RequestedKeys { [Fact] public async void RequestedKeysWorks() { //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["result"]["buildMode"].Value(); BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" })); if (BuildMode == "DEBUG") { //Make a "list" of keys to fetch the values for List keys = new List(); keys.AddRange(new string[] { "HelpLicense", "ClientName" }); dynamic d = new JObject(); d.localeId = 1; d.keys = 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["result"]).Count.Should().Be(2); //Now ensure there are at least two keys in the fetched keys array a = await Util.PostAsync("Locale/RequestedKeyList", 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["result"]).Count.Should().Be(2); } } //================================================== }//eoc }//eons