public void GetImage_WithCustomParametricDecoder_ShouldNotUtilizeCache_WhenParametersAreNotEqual <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { Assert.NotNull(provider.Utility.SourceFileOrDescription); TestDecoderWithParameters.DoTestThreadSafe( () => { string testName = nameof(this.GetImage_WithCustomParametricDecoder_ShouldNotUtilizeCache_WhenParametersAreNotEqual); var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 42 }; decoder1.InitCaller(testName); var decoder2 = new TestDecoderWithParameters() { Param1 = "LoL", Param2 = 42 }; decoder2.InitCaller(testName); provider.GetImage(decoder1); Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName)); provider.GetImage(decoder2); Assert.Equal(2, TestDecoderWithParameters.GetInvocationCount(testName)); }); }
public void GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual <TPixel>(TestImageProvider <TPixel> provider) where TPixel : struct, IPixel <TPixel> { if (!TestEnvironment.Is64BitProcess) { // We don't cache with the 32 bit build. return; } Assert.NotNull(provider.Utility.SourceFileOrDescription); TestDecoderWithParameters.DoTestThreadSafe(() => { string testName = nameof(this.GetImage_WithCustomParametricDecoder_ShouldUtilizeCache_WhenParametersAreEqual); var decoder1 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 }; decoder1.InitCaller(testName); var decoder2 = new TestDecoderWithParameters() { Param1 = "Lol", Param2 = 666 }; decoder2.InitCaller(testName); provider.GetImage(decoder1); Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName)); provider.GetImage(decoder2); Assert.Equal(1, TestDecoderWithParameters.GetInvocationCount(testName)); }); }