public void SentHeartbeatContainsExpectedDefaultFields() { using (var hbeatMock = new HeartbeatProviderMock()) { var baseHbeatProps = new BaseDefaultHeartbeatPropertyProvider().DefaultFields; var taskWaiter = HeartbeatDefaultPayload.PopulateDefaultPayload(new string[] { }, new string[] { }, hbeatMock).ConfigureAwait(false); Assert.IsTrue(taskWaiter.GetAwaiter().GetResult()); // no await for tests foreach (string fieldName in baseHbeatProps) { Assert.IsTrue(hbeatMock.HeartbeatProperties.ContainsKey(fieldName)); } } }
public void DefaultHeartbeatPropertyProviderSendsNoFieldWhenDisabled() { var mockHbeat = new HeartbeatProviderMock(); IHeartbeatDefaultPayloadProvider baseDefaultProvider = HeartbeatDefaultPayload.DefaultPayloadProviders.First(); var hbeatPayload = HeartbeatDefaultPayload.PopulateDefaultPayload(new string[] { }, new string[] { baseDefaultProvider.Name }, mockHbeat); hbeatPayload.GetAwaiter().GetResult(); // for each heartbeat property recorded into the heartbeat provider, none should be a registered keyword on // this base default heartbeat property provider. foreach (string payloadPropertyName in mockHbeat.HeartbeatProperties.Keys) { Assert.IsFalse(baseDefaultProvider.IsKeyword(payloadPropertyName)); } }