Skip to content

Feature Flag Local Evaluation Implementation #68

Feature Flag Local Evaluation Implementation

Feature Flag Local Evaluation Implementation #68

GitHub Actions / xUnit Tests succeeded Jan 25, 2025 in 0s

98 passed, 0 failed and 0 skipped

Tests passed successfully

✅ tests/UnitTests/TestResults/test-results.trx

98 tests were completed in 974ms with 98 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
AsyncBatchHandlerTests.TheDisposeAsyncMethod 3✅ 13ms
AsyncBatchHandlerTests.TheEnqueueMethod 6✅ 128ms
FeatureFlagExtensionsTests.TheIsFeatureEnabledAsyncMethod 4✅ 287ms
FilterPropertyValueTests.TheIsExactMatchMethod 6✅ 19ms
HttpContextFeatureFlagCacheTests.TheGetAndCacheFeatureFlagsAsyncMethod 3✅ 111ms
JsonSerializerHelperTests.TheDeserializeFromCamelCaseJsonMethod 9✅ 63ms
JsonSerializerHelperTests.TheSerializeToCamelCaseJsonMethod 2✅ 39ms
LocalEvaluatorTests.TheMatchPropertyMethod 28✅ 10ms
PayloadExtensionsTests.TheAddToPayloadMethod 5✅ 14ms
PostHogApiClientTests.TheCaptureBatchAsyncMethod 1✅ 7ms
PostHogClientTests.TheGetFeatureFlagAsyncMethod 8✅ 35ms
PostHogClientTests.TheGetFeatureFlagsAsyncMethod 1✅ 96ms
PostHogClientTests.TheIsFeatureFlagEnabledAsyncMethod 2✅ 173ms
RelativeDateParserTests.TheParseRelativeDateForFeatureFlagMethod 5✅ 4ms
StringOrValueSerializationTests.TheDeserializeMethod 2✅ 4ms
StringOrValueSerializationTests.TheImplicitOperators 2✅ 5ms
StringOrValueSerializationTests.TheSerializeMethod 6✅ 32ms
StringOrValueTests.AssignmentTests 2✅ 1ms
StringOrValueTests.EqualityTests 3✅ 16ms

✅ AsyncBatchHandlerTests.TheDisposeAsyncMethod

✅ DoesNotDisposeTwice
✅ FlushesBatchWhenDisposed
✅ HandlesExceptionsInFlushBatchAsync

✅ AsyncBatchHandlerTests.TheEnqueueMethod

✅ CallsBatchHandlerUntilQueueDrained
✅ CallsBatchHandlerWhenThresholdMet
✅ DropsOlderEventsWhenMaxQueueMet
✅ FlushBatchAsyncContinuesAfterException
✅ FlushesBatchOnTimer
✅ IgnoresEnqueuedItemAfterDispose

✅ FeatureFlagExtensionsTests.TheIsFeatureEnabledAsyncMethod

✅ ReturnsFlagResult(enabled: False)
✅ ReturnsFlagResult(enabled: True)
✅ ReturnsNullWhenFlagDoesNotExist
✅ ReturnsTrueWhenFlagReturnsString

✅ FilterPropertyValueTests.TheIsExactMatchMethod

✅ ReturnsTrueWhenPropertyValueIsInDoubleArray
✅ ReturnsTrueWhenPropertyValueIsInIntArray
✅ ReturnsTrueWhenPropertyValueIsInStringArray
✅ ReturnsTrueWhenPropertyValueMatchesDouble
✅ ReturnsTrueWhenPropertyValueMatchesInt
✅ ReturnsTrueWhenPropertyValueMatchesString

✅ HttpContextFeatureFlagCacheTests.TheGetAndCacheFeatureFlagsAsyncMethod

✅ CachesFlagsInHttpContext
✅ DoesNotCacheIfHttpContextIsNull
✅ ReturnsCachedFlagsFromHttpContext

✅ JsonSerializerHelperTests.TheDeserializeFromCamelCaseJsonMethod

✅ CanDeserializeCamelCasedStringOrBool
✅ CanDeserializeFilterProperty
✅ CanDeserializeJsonToDecideApiResult
✅ CanDeserializeLocalEvaluationApiResult
✅ CanDeserializeNegatedJsonToDecideApiResult
✅ CanDeserializePropertiesDictionaryWithNullValue
✅ CanDeserializeStringOrBool
✅ CanDeserializeStringOrBoolWithFalse
✅ ShouldDeserializeApiResult

✅ JsonSerializerHelperTests.TheSerializeToCamelCaseJsonMethod

✅ CanSerializeFilterProperty
✅ ShouldSerializeObjectToCamelCaseJson

✅ LocalEvaluatorTests.TheMatchPropertyMethod

✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-1m", joinDate: "2023-12-22T22:15:49Z", expected: False)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-1m", joinDate: "2023-12-22T22:15:51Z", expected: True)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-1y", joinDate: "2023-01-22T22:15:49Z", expected: False)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-1y", joinDate: "2023-01-22T22:15:51Z", expected: True)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-24d", joinDate: "2023-12-29T22:15:49Z", expected: False)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-24d", joinDate: "2023-12-29T22:15:51Z", expected: True)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-2w", joinDate: "2024-01-08T22:15:49Z", expected: False)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-2w", joinDate: "2024-01-08T22:15:51Z", expected: True)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-30h", joinDate: "2024-01-21T16:15:49Z", expected: False)
✅ CanPerformIsDateAfterComparisonCorrectly(relativeDateString: "-30h", joinDate: "2024-01-21T16:15:51Z", expected: True)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-1m", joinDate: "2023-12-22T22:15:49Z", expected: True)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-1m", joinDate: "2023-12-22T22:15:51Z", expected: False)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-1y", joinDate: "2023-01-22T22:15:49Z", expected: True)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-1y", joinDate: "2023-01-22T22:15:51Z", expected: False)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-24d", joinDate: "2023-12-29T22:15:49Z", expected: True)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-24d", joinDate: "2023-12-29T22:15:51Z", expected: False)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-2w", joinDate: "2024-01-08T22:15:49Z", expected: True)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-2w", joinDate: "2024-01-08T22:15:51Z", expected: False)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-30h", joinDate: "2024-01-21T16:15:49Z", expected: True)
✅ CanPerformIsDateBeforeComparisonCorrectly(relativeDateString: "-30h", joinDate: "2024-01-21T16:15:51Z", expected: False)
✅ HandlesExactMatchWithDoubleValuesArray(age: 23.489999999999998, expected: False)
✅ HandlesExactMatchWithDoubleValuesArray(age: 42.420000000000002, expected: True)
✅ HandlesExactMatchWithIntValuesArray(age: 21, expected: False)
✅ HandlesExactMatchWithIntValuesArray(age: 42, expected: True)
✅ HandlesExactMatchWithStringValuesArray(email: "[email protected]", expected: False)
✅ HandlesExactMatchWithStringValuesArray(email: "[email protected]", expected: True)
✅ HandlesExactMatchWithStringValuesArray(email: "[email protected]", expected: True)
✅ MatchesRegexUserProperty

✅ PayloadExtensionsTests.TheAddToPayloadMethod

✅ AddsGroupPropertiesWithGroupInitializer
✅ AddsGroupsToGroups
✅ AddsToExistingGroupsAndGroupProperties
✅ AddsToGroups
✅ AddsToGroupsWithCollectionInitializer

✅ PostHogApiClientTests.TheCaptureBatchAsyncMethod

✅ SendsBatchToCaptureEndpoint

✅ PostHogClientTests.TheGetFeatureFlagAsyncMethod

✅ CapturesFeatureFlagCalledEvent
✅ CapturesFeatureFlagCalledEventAgainIfCacheLimitExceededAndIsCompacted
✅ CapturesFeatureFlagCalledEventAgainIfCacheSlidingWindowExpirationOccurs
✅ DoesNotCaptureFeatureFlagCalledEventWhenSendFeatureFlagsFalse
✅ ReturnsFlag(enabled: False)
✅ ReturnsFlag(enabled: True)
✅ ReturnsStringFlag
✅ ReturnsUndefinedWhenFlagDoesNotExist

✅ PostHogClientTests.TheGetFeatureFlagsAsyncMethod

✅ RetrievesFlagFromHttpContextCacheOnSecondCall

✅ PostHogClientTests.TheIsFeatureFlagEnabledAsyncMethod

✅ CapturesFeatureFlagCalledEventOnlyOncePerDistinctIdAndFlagKey
✅ DoesNotCaptureFeatureFlagCalledEventWhenSendFeatureFlagsFalse

✅ RelativeDateParserTests.TheParseRelativeDateForFeatureFlagMethod

✅ CanCompareSpecifiedDateWithRelativeDate(relativeDateString: "-1m", nowDate: "2024-01-22T22:15:50Z", expectedBefore: "2023-12-22T22:15:49Z", expectedAfter: "2023-12-22T22:15:51Z")
✅ CanCompareSpecifiedDateWithRelativeDate(relativeDateString: "-1y", nowDate: "2024-01-22T22:15:50Z", expectedBefore: "2023-01-22T22:15:49Z", expectedAfter: "2023-01-22T22:15:50Z")
✅ CanCompareSpecifiedDateWithRelativeDate(relativeDateString: "-24d", nowDate: "2024-01-22T22:15:50Z", expectedBefore: "2023-12-29T22:15:49Z", expectedAfter: "2023-12-29T22:15:51Z")
✅ CanCompareSpecifiedDateWithRelativeDate(relativeDateString: "-2w", nowDate: "2024-01-22T22:15:50Z", expectedBefore: "2024-01-08T22:15:49Z", expectedAfter: "2024-01-08T22:15:51Z")
✅ CanCompareSpecifiedDateWithRelativeDate(relativeDateString: "-30h", nowDate: "2024-01-22T22:15:50Z", expectedBefore: "2024-01-21T16:15:49Z", expectedAfter: "2024-01-21T16:15:51Z")

✅ StringOrValueSerializationTests.TheDeserializeMethod

✅ CanDeserializeStringOrValueWithStringValues
✅ CanDeserializeStringOrValueWithValues

✅ StringOrValueSerializationTests.TheImplicitOperators

✅ CanImplicitlyConvertIntToStringOrValue
✅ CanImplicitlyConvertStringToStringOrValue

✅ StringOrValueSerializationTests.TheSerializeMethod

✅ CanSerializeObjectWithStringOrObjectStringValue
✅ CanSerializeObjectWithStringOrObjectValue
✅ CanSerializeObjectWithStringOrStringValue
✅ CanSerializeObjectWithStringOrValue
✅ CanSerializeSingleIntValue
✅ CanSerializeSingleString

✅ StringOrValueTests.AssignmentTests

✅ CanImplicitlyAssignBool
✅ CanImplicitlyAssignString

✅ StringOrValueTests.EqualityTests

✅ CanCompareDefaults
✅ CanCompareNullables
✅ CanCompareStringOrValue