public void TestActorSettings() { var actorType = typeof(TestActor); var actorRuntime = new ActorRuntime(); Assert.Empty(actorRuntime.RegisteredActorTypes); actorRuntime.ConfigureActorSettings(a => { a.ActorIdleTimeout = TimeSpan.FromSeconds(33); a.ActorScanInterval = TimeSpan.FromSeconds(44); a.DrainOngoingCallTimeout = TimeSpan.FromSeconds(55); a.DrainRebalancedActors = true; }); actorRuntime.RegisterActor <TestActor>(); Assert.Contains(actorType.Name, actorRuntime.RegisteredActorTypes, StringComparer.InvariantCulture); ArrayBufferWriter <byte> writer = new ArrayBufferWriter <byte>(); actorRuntime.SerializeSettingsAndRegisteredTypes(writer).GetAwaiter().GetResult(); // read back the serialized json var array = writer.WrittenSpan.ToArray(); string s = Encoding.UTF8.GetString(array, 0, array.Length); JsonDocument document = JsonDocument.Parse(s); JsonElement root = document.RootElement; // parse out the entities array JsonElement element = root.GetProperty("entities"); Assert.Equal(1, element.GetArrayLength()); JsonElement arrayElement = element[0]; string actor = arrayElement.GetString(); Assert.Equal("TestActor", actor); // validate the other properties have expected values element = root.GetProperty("actorIdleTimeout"); Assert.Equal(TimeSpan.FromSeconds(33), ConverterUtils.ConvertTimeSpanFromDaprFormat(element.GetString())); element = root.GetProperty("actorScanInterval"); Assert.Equal(TimeSpan.FromSeconds(44), ConverterUtils.ConvertTimeSpanFromDaprFormat(element.GetString())); element = root.GetProperty("drainOngoingCallTimeout"); Assert.Equal(TimeSpan.FromSeconds(55), ConverterUtils.ConvertTimeSpanFromDaprFormat(element.GetString())); element = root.GetProperty("drainRebalancedActors"); Assert.True(element.GetBoolean()); }