Skip to content

Commit

Permalink
Update OverrideTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Apr 5, 2022
1 parent 6a9a4ad commit ac657c8
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/ConfigCat.Client.Tests/OverrideTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,35 @@ public async Task LocalFile_Watcher_Reload()
Assert.AreEqual("initial", await client.GetValueAsync("fakeKey", string.Empty));

await WriteContent(SampleFileToCreate, "modified");
await Task.Delay(1100);
await Task.Delay(1500);

Assert.AreEqual("modified", await client.GetValueAsync("fakeKey", string.Empty));

File.Delete(SampleFileToCreate);
}

[TestMethod]
public async Task LocalFile_Watcher_Reload_Sync()
{
await CreateFileAndWriteContent(SampleFileToCreate, "initial");

using var client = new ConfigCatClient(options =>
{
options.SdkKey = "localhost";
options.FlagOverrides = FlagOverrides.LocalFile(SampleFileToCreate, true, OverrideBehaviour.LocalOnly);
options.Logger.LogLevel = LogLevel.Info;
});

Assert.AreEqual("initial", client.GetValue("fakeKey", string.Empty));

await WriteContent(SampleFileToCreate, "modified");
await Task.Delay(1500);

Assert.AreEqual("modified", client.GetValue("fakeKey", string.Empty));

File.Delete(SampleFileToCreate);
}

private static string GetJsonContent(string value)
{
return $"{{ \"f\": {{ \"fakeKey\": {{ \"v\": \"{value}\", \"p\": [] ,\"r\": [] }} }} }}";
Expand Down

0 comments on commit ac657c8

Please sign in to comment.