Exemple #1
0
        public void GivenMethod_WhenMultipleArgumentsSupplied_ThenKeyShouldContainTypeAndMethodNameAndArgumentNames()
        {
            // Arrange
            var methodInfo = typeof(ServiceToCache).GetMethod(nameof(ServiceToCache.GetDataThreeArgs));
            var sut        = new MethodMetadataBasedCacheOptionsKeyGenerator();

            // Act
            var result = sut.GetOptionsKey(methodInfo);

            // Assert
            Assert.Equal("Flache.UnitTests.Helpers.ServiceToCache.GetDataThreeArgs:System.String|System.Int32|System.Int32", result);
        }
Exemple #2
0
        public void GivenMethod_WhenNestedGenericArgumentSupplied_ThenKeyShouldContainTypeAndMethodNameAndNestedGenericTypeNames()
        {
            // Arrange
            var methodInfo = typeof(ServiceToCache).GetMethod(nameof(ServiceToCache.GetDataSingleNestedGenericArg));
            var sut        = new MethodMetadataBasedCacheOptionsKeyGenerator();

            // Act
            var result = sut.GetOptionsKey(methodInfo);

            // Assert
            Assert.StartsWith("Flache.UnitTests.Helpers.ServiceToCache.GetDataSingleNestedGenericArg:" +
                              "Flache.UnitTests.Helpers.Request`1[[System.Collections.Generic.List`1" +
                              "[[Flache.UnitTests.Helpers.Parameter", result);
        }