Output1

Namespace: SharpDX.DXGI
We found 10 examples in language CSharp for this search. You will see 53 fragments of code.
			
			static public int RegexPartOut(this string item, Regex pattern, out string output1)
			{
				return item.RegexMatch(pattern).Groups
					.Bridge<Group>()
					.Offset(1)
					.Convert(g => g.Value)
					.PartOut(out output1);
			}
		
			static public int RegexPartOut(this string item, string pattern, out string output1)
			{
				return item.RegexMatch(pattern).Groups
					.Bridge<Group>()
					.Offset(1)
					.Convert(g => g.Value)
					.PartOut(out output1);
			}
		
			static public int RegexPartOut(this string item, CachedRegex pattern, out string output1)
			{
				return item.RegexMatch(pattern).Groups
					.Bridge<Group>()
					.Offset(1)
					.Convert(g => g.Value)
					.PartOut(out output1);
			}
					
			static public int RegexPartOut(this string item, Regex pattern, out string output1, out string output2)
			{
				return item.RegexMatch(pattern).Groups
					.Bridge<Group>()
					.Offset(1)
					.Convert(g => g.Value)
					.PartOut(out output1, out output2);
			}
		
			static public int RegexPartOut(this string item, string pattern, out string output1, out string output2)
			{
				return item.RegexMatch(pattern).Groups
					.Bridge<Group>()
					.Offset(1)
					.Convert(g => g.Value)
					.PartOut(out output1, out output2);
			}
		
			static public int RegexPartOut(this string item, CachedRegex pattern, out string output1, out string output2)
			{
				return item.RegexMatch(pattern).Groups
					.Bridge<Group>()
					.Offset(1)
					.Convert(g => g.Value)
					.PartOut(out output1, out output2);
			}

		
        static public int PartOut<T>(this IEnumerable<T> item, out T output1)
        {
					output1 = default(T);
		
            using (IEnumerator<T> iterator = item.GetEnumerator())
            {
							if (iterator.MoveNext())
				{
					output1 = iterator.Current;
											return 1;
				}
			            }

            return 0;
        }
		
        static public int PartOut<T>(this IEnumerable<T> item, out T output1, out T output2)
        {
					output1 = default(T);
					output2 = default(T);
		
            using (IEnumerator<T> iterator = item.GetEnumerator())
            {
							if (iterator.MoveNext())
				{
					output1 = iterator.Current;
							if (iterator.MoveNext())
				{
					output2 = iterator.Current;
											return 2;
				}
								return 1;
				}
			            }

            return 0;
        }
	
		
        static public int PartOut<T>(this IEnumerable<IEnumerable<T>> item, ICollection<T> output1)
        {
							output1.Clear();
			
            using (IEnumerator<IEnumerable<T>> iterator = item.GetEnumerator())
            {
							if (iterator.MoveNext())
				{
					output1.AddRange(iterator.Current);
											return 1;
				}
			            }

            return 0;
        }


        public bool Block6Info()
        {
            byte[] output1;
            if (UID != 0)
            {
                if (MernokRFID_interface.Mifair_Read_Block(0, 0, cardDetails.Block6_Addr, out output1))
                {
                    OperatorName_read(output1);
                    return true;
                }
                else
                    return false;
            }
            else
                return false;
        }

        public bool Block8Info()
        {
            byte[] output1;
            if (UID != 0)
            {
                if (MernokRFID_interface.Mifair_Read_Block(0, 0, cardDetails.Block8_Addr, out output1))
                {
                    EngineerName_read(output1);
                    return true;
                }
                else
                    return false;
            }
            else
                return false;
        }

        public bool Block10Info()
        {
            byte[] output1;
            if (UID != 0)
            {
                if (MernokRFID_interface.Mifair_Read_Block(0, 0, cardDetails.Block10_Addr, out output1))
                {
                    VehicleGroup_read(output1);
                    return true;
                }
                else
                    return false;
            }
            else
                return false;
        }
        public bool Block12Info()
        {
            byte[] output1;
            if (UID != 0)
            {
                if (MernokRFID_interface.Mifair_Read_Block(0, 0, cardDetails.Block12_Addr, out output1))
                {
                    OperatorID_read(output1);
                    return true;
                }
                else
                    return false;
            }
            else
                return false;
        }
        public bool Block31Info()
        {
            byte[] output1;
            if (UID != 0)
            {
                if (MernokRFID_interface.Mifair_Read_Block(0, 0, cardDetails.Block18_Addr, out output1))
                {
                    OperatorSurname_read(output1);
                    return true;
                }
                else
                    return false;
            }
            else
                return false;
        }


            public override int GetHashCode()
            {
                return Output1.GetHashCode() + Output2.GetHashCode();
            }

        public override Pair Common(Pair pair1, Pair pair2)
        {
            Debug.Assert(Valid(pair1));
            Debug.Assert(Valid(pair2));
            return NewPair(outputs1.Common(pair1.Output1, pair2.Output1), outputs2.Common(pair1.Output2, pair2.Output2));
        }

        public override Pair Subtract(Pair output, Pair inc)
        {
            Debug.Assert(Valid(output));
            Debug.Assert(Valid(inc));
            return NewPair(outputs1.Subtract(output.Output1, inc.Output1), outputs2.Subtract(output.Output2, inc.Output2));
        }

        public override Pair Add(Pair prefix, Pair output)
        {
            Debug.Assert(Valid(prefix));
            Debug.Assert(Valid(output));
            return NewPair(outputs1.Add(prefix.Output1, output.Output1), outputs2.Add(prefix.Output2, output.Output2));
        }

        public override void Write(Pair output, DataOutput writer)
        {
            Debug.Assert(Valid(output));
            outputs1.Write(output.Output1, writer);
            outputs2.Write(output.Output2, writer);
        }

        public override Pair Read(DataInput @in)
        {
            A output1 = outputs1.Read(@in);
            B output2 = outputs2.Read(@in);
            return NewPair(output1, output2);
        }

        public static void Main(string[] args)
        {
        long seed = ConfigProgramForBenchmarking();
        Stopwatch sw = new Stopwatch();
        string warmup = "This is   a Warm  up function for best   benchmark results." + seed;
        string input1 = "Hello World,    how are   you           doing?" + seed;
        string input2 = "It\twas\t \tso    nice  to\t\t see you \tin 1950.  \t" + seed;
        string correctOutput1 = "Hello World, how are you doing?" + seed;
        string correctOutput2 = "It\twas\tso nice to\tsee you in 1950. " + seed;
        string output1,output2;
        //warm-up timer function
        sw.Restart();
        sw.Stop();
        sw.Restart();
        sw.Stop();
        long baseVal = sw.ElapsedTicks;
        // InPlace Replace by Felipe Machado but modified by Ryan for multi-space removal (http://www.codeproject.com/Articles/1014073/Fastest-method-to-remove-all-whitespace-from-Strin)
        output1 = InPlaceCharArraySpaceOnly (warmup);
        sw.Restart();
        output1 = InPlaceCharArraySpaceOnly (input1);
        output2 = InPlaceCharArraySpaceOnly (input2);
        sw.Stop();
        Console.WriteLine("InPlaceCharArraySpaceOnly : " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        // InPlace Replace by Felipe R. Machado and slightly modified by Ryan for multi-space removal (http://www.codeproject.com/Articles/1014073/Fastest-method-to-remove-all-whitespace-from-Strin)
        output1 = InPlaceCharArray(warmup);
        sw.Restart();
        output1 = InPlaceCharArray(input1);
        output2 = InPlaceCharArray(input2);
        sw.Stop();
        Console.WriteLine("InPlaceCharArray: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //Regex with non-compile Tim Hoolihan (https://stackoverflow.com/a/1279874/2352507)
        string cleanedString = 
        output1 = Regex.Replace(warmup, @"\s+", " ");
        sw.Restart();
        output1 = Regex.Replace(input1, @"\s+", " ");
        output2 = Regex.Replace(input2, @"\s+", " ");
        sw.Stop();
        Console.WriteLine("Regex by Tim Hoolihan: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //Regex with compile by Jon Skeet (https://stackoverflow.com/a/1280227/2352507)
        output1 = MultipleSpaces.Replace(warmup, " ");
        sw.Restart();
        output1 = MultipleSpaces.Replace(input1, " ");
        output2 = MultipleSpaces.Replace(input2, " ");
        sw.Stop();
        Console.WriteLine("Regex with compile by Jon Skeet: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //Split And Join by Jon Skeet (https://stackoverflow.com/a/1280227/2352507)
        output1 = SplitAndJoinOnSpace(warmup);
        sw.Restart();
        output1 = SplitAndJoinOnSpace(input1);
        output2 = SplitAndJoinOnSpace(input2);
        sw.Stop();
        Console.WriteLine("Split And Join by Jon Skeet: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //Regex by Brandon (https://stackoverflow.com/a/1279878/2352507
        output1 = Regex.Replace(warmup, @"\s{2,}", " ");
        sw.Restart();
        output1 = Regex.Replace(input1, @"\s{2,}", " ");
        output2 = Regex.Replace(input2, @"\s{2,}", " ");
        sw.Stop();
        Console.WriteLine("Regex by Brandon: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //StringBuilder by user214147 (https://stackoverflow.com/a/2156660/2352507
        output1 = user214147(warmup);
        sw.Restart();
        output1 = user214147(input1);
        output2 = user214147(input2);
        sw.Stop();
        Console.WriteLine("StringBuilder by user214147: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //StringBuilder by fubo (https://stackoverflow.com/a/27502353/2352507
        output1 = fubo(warmup);
        sw.Restart();
        output1 = fubo(input1);
        output2 = fubo(input2);
        sw.Stop();
        Console.WriteLine("StringBuilder by fubo: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
        //StringBuilder by David S 2013 (https://stackoverflow.com/a/16035044/2352507)
        output1 = SingleSpacedTrim(warmup);
        sw.Restart();
        output1 = SingleSpacedTrim(input1);
        output2 = SingleSpacedTrim(input2);
        sw.Stop();
        Console.WriteLine("StringBuilder(SingleSpacedTrim) by David S: " + (sw.ElapsedTicks - baseVal));
        Console.WriteLine("  Trial1:(spaces only) " + (output1 == correctOutput1 ? "PASS " : "FAIL "));
        Console.WriteLine("  Trial2:(spaces+tabs) " + (output2 == correctOutput2 ? "PASS " : "FAIL "));
    }
    // InPlace Replace by Felipe Machado and slightly modified by Ryan for multi-space removal (http://www.codeproject.com/Articles/1014073/Fastest-method-to-remove-all-whitespace-from-Strin)
    static string InPlaceCharArray(string str)
    {
        var len = str.Length;
        var src = str.ToCharArray();
        int dstIdx = 0;
        bool lastWasWS = false;
        for (int i = 0; i < len; i++)
        {
            var ch = src[i];
            if (src[i] == '\u0020')
            {
                if (lastWasWS == false)
                {
                    src[dstIdx++] = ch;
                    lastWasWS = true;
                }
            }
            else
            { 
                lastWasWS = false;
                src[dstIdx++] = ch;
            }
        }
        return new string(src, 0, dstIdx);
    }
    // InPlace Replace by Felipe R. Machado but modified by Ryan for multi-space removal (http://www.codeproject.com/Articles/1014073/Fastest-method-to-remove-all-whitespace-from-Strin)
    static string InPlaceCharArraySpaceOnly (string str)
    {
        var len = str.Length;
        var src = str.ToCharArray();
        int dstIdx = 0;
        bool lastWasWS = false; //Added line
        for (int i = 0; i < len; i++)
        {
            var ch = src[i];
            switch (ch)
            {
                case '\u0020': //SPACE
                case '\u00A0': //NO-BREAK SPACE
                case '\u1680': //OGHAM SPACE MARK
                case '\u2000': // EN QUAD
                case '\u2001': //EM QUAD
                case '\u2002': //EN SPACE
                case '\u2003': //EM SPACE
                case '\u2004': //THREE-PER-EM SPACE
                case '\u2005': //FOUR-PER-EM SPACE
                case '\u2006': //SIX-PER-EM SPACE
                case '\u2007': //FIGURE SPACE
                case '\u2008': //PUNCTUATION SPACE
                case '\u2009': //THIN SPACE
                case '\u200A': //HAIR SPACE
                case '\u202F': //NARROW NO-BREAK SPACE
                case '\u205F': //MEDIUM MATHEMATICAL SPACE
                case '\u3000': //IDEOGRAPHIC SPACE
                case '\u2028': //LINE SEPARATOR
                case '\u2029': //PARAGRAPH SEPARATOR
                case '\u0009': //[ASCII Tab]
                case '\u000A': //[ASCII Line Feed]
                case '\u000B': //[ASCII Vertical Tab]
                case '\u000C': //[ASCII Form Feed]
                case '\u000D': //[ASCII Carriage Return]
                case '\u0085': //NEXT LINE
                    if (lastWasWS == false) //Added line
                    {
                        src[dstIdx++] = ch; //Added line
                        lastWasWS = true; //Added line
                    }
                continue;
                default:
                    lastWasWS = false; //Added line 
                    src[dstIdx++] = ch;
                    break;
            }
        }
        return new string(src, 0, dstIdx);
    }
    //Split And Join by Jon Skeet (https://stackoverflow.com/a/1280227/2352507)
    static string SplitAndJoinOnSpace(string input)
    {
        string[] split = input.Split(new char[] { ' '}, StringSplitOptions.RemoveEmptyEntries);
        return string.Join(" ", split);
    }
    //StringBuilder by user214147 (https://stackoverflow.com/a/2156660/2352507
    public static string user214147(string S)
    {
        string s = S.Trim();
        bool iswhite = false;
        int iwhite;
        int sLength = s.Length;
        StringBuilder sb = new StringBuilder(sLength);
        foreach (char c in s.ToCharArray())
        {
            if (Char.IsWhiteSpace(c))
            {
                if (iswhite)
                {
                    //Continuing whitespace ignore it.
                    continue;
                }
                else
                {
                    //New WhiteSpace
                    //Replace whitespace with a single space.
                    sb.Append(" ");
                    //Set iswhite to True and any following whitespace will be ignored
                    iswhite = true;
                }
            }
            else
            {
                sb.Append(c.ToString());
                //reset iswhitespace to false
                iswhite = false;
            }
        }
        return sb.ToString();
    }
    //StringBuilder by fubo (https://stackoverflow.com/a/27502353/2352507
    public static string fubo(this string Value)
    {
        StringBuilder sbOut = new StringBuilder();
        if (!string.IsNullOrEmpty(Value))
        {
            bool IsWhiteSpace = false;
            for (int i = 0; i < Value.Length; i++)
            {
                if (char.IsWhiteSpace(Value[i])) //Comparison with WhiteSpace
                {
                    if (!IsWhiteSpace) //Comparison with previous Char
                    {
                        sbOut.Append(Value[i]);
                        IsWhiteSpace = true;
                    }
                }
                else
                {
                    IsWhiteSpace = false;
                    sbOut.Append(Value[i]);
                }
            }
        }
        return sbOut.ToString();
    }


        [Fact]
        public async Task ProcessAsync_DoesNotCache_IfDisabled()
        {
            // Arrange
            var childContent = "original-child-content";
            var storage = new Mock<IDistributedCacheTagHelperStorage>();
            var value = Encoding.UTF8.GetBytes("ok");
            storage.Setup(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()));
            storage.Setup(c => c.GetAsync(It.IsAny<string>()))
                .Returns(Task.FromResult(value));
            var tagHelperContext = GetTagHelperContext();
            var service = new DistributedCacheTagHelperService(
                storage.Object,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = false
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());
            storage.Verify(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*content*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()),
                Times.Never);
        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfEnabled()
        {
            // Arrange
            var childContent = "original-child-content";
            var storage = new Mock<IDistributedCacheTagHelperStorage>();
            var value = Encoding.UTF8.GetBytes(childContent);
            storage.Setup(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()));
            storage.Setup(c => c.GetAsync(It.IsAny<string>()))
                .Returns(Task.FromResult<byte[]>(null));
            var service = new DistributedCacheTagHelperService(
                storage.Object,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperContext = GetTagHelperContext();
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = true,
                Name = "some-name"
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Empty(tagHelperOutput.PreContent.GetContent());
            Assert.Empty(tagHelperOutput.PostContent.GetContent());
            Assert.True(tagHelperOutput.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());

            storage.Verify(c => c.GetAsync(
                /*key*/ It.IsAny<string>()
                ),
                Times.Once);

            storage.Verify(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ It.IsAny<byte[]>(),
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()),
                Times.Once);

        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfVaryByParamIsUnchanged()
        {
            // Arrange - 1
            var childContent = "original-child-content";
            var storage = GetStorage();
            var formatter = GetFormatter();
            var tagHelperContext1 = GetTagHelperContext();
            var tagHelperOutput1 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var service = new DistributedCacheTagHelperService(
                storage,
                formatter,
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var cacheTagHelper1 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                Enabled = true,
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var tagHelperContext2 = GetTagHelperContext();
            var tagHelperOutput2 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: "different-content");
            var cacheTagHelper2 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                Enabled = true,
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public async Task ProcessAsync_RecalculatesValueIfCacheKeyChanges()
        {
            // Arrange - 1
            var childContent1 = "original-child-content";
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperContext1 = GetTagHelperContext();
            var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1);
            tagHelperOutput1.PreContent.Append("<cache>");
            tagHelperOutput1.PostContent.SetContent("</cache>");
            var cacheTagHelper1 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2";

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var childContent2 = "different-content";
            var tagHelperContext2 = GetTagHelperContext();
            var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2);
            tagHelperOutput2.PreContent.SetContent("<cache>");
            tagHelperOutput2.PostContent.SetContent("</cache>");
            var cacheTagHelper2 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresOnIsSet()
        {
            // Arrange
            var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4);
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance
                );
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ExpiresOn = expiresOn
            };

            // Act
            var cacheEntryOptions = cacheTagHelper.GetDistributedCacheEntryOptions();

            // Assert
            Assert.Equal(expiresOn, cacheEntryOptions.AbsoluteExpiration);
        }

        [Fact]
        public void UpdateCacheEntryOptions_DefaultsTo30SecondsSliding_IfNoEvictionCriteriaIsProvided()
        {
            // Arrange
            var slidingExpiresIn = TimeSpan.FromSeconds(30);
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance
                );
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder());

            // Act
            var cacheEntryOptions = cacheTagHelper.GetDistributedCacheEntryOptions();

            // Assert
            Assert.Equal(slidingExpiresIn, cacheEntryOptions.SlidingExpiration);
        }

        [Fact]
        public async Task ProcessAsync_DoesNotCache_IfDisabled()
        {
            // Arrange
            var id = "unique-id";
            var childContent = "original-child-content";
            var cache = new Mock<IMemoryCache>();
            var value = new Mock<ICacheEntry>();
            value.Setup(c => c.Value).Returns(new DefaultTagHelperContent().SetContent("ok"));
            cache.Setup(c => c.CreateEntry(
                /*key*/ It.IsAny<string>()))
                .Returns((object key) => value.Object)
                .Verifiable();
            object cacheResult;
            cache.Setup(c => c.TryGetValue(It.IsAny<string>(), out cacheResult))
                .Returns(false);
            var tagHelperContext = GetTagHelperContext(id);
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new CacheTagHelper(cache.Object, new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = false
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());
            cache.Verify(c => c.CreateEntry(
                /*key*/ It.IsAny<string>()),
                Times.Never);
        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfEnabled()
        {
            // Arrange
            var id = "unique-id";
            var childContent = "original-child-content";
            var cache = new MemoryCache(new MemoryCacheOptions());
            var tagHelperContext = GetTagHelperContext(id);
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = true
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Empty(tagHelperOutput.PreContent.GetContent());
            Assert.Empty(tagHelperOutput.PostContent.GetContent());
            Assert.True(tagHelperOutput.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());
        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfVaryByParamIsUnchanged()
        {
            // Arrange - 1
            var id = "unique-id";
            var childContent = "original-child-content";
            var cache = new MemoryCache(new MemoryCacheOptions());
            var tagHelperContext1 = GetTagHelperContext(id);
            var tagHelperOutput1 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper1 = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var tagHelperContext2 = GetTagHelperContext(id);
            var tagHelperOutput2 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: "different-content");
            var cacheTagHelper2 = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public async Task ProcessAsync_RecalculatesValueIfCacheKeyChanges()
        {
            // Arrange - 1
            var id = "unique-id";
            var childContent1 = "original-child-content";
            var cache = new MemoryCache(new MemoryCacheOptions());
            var tagHelperContext1 = GetTagHelperContext(id);
            var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1);
            tagHelperOutput1.PreContent.Append("<cache>");
            tagHelperOutput1.PostContent.SetContent("</cache>");
            var cacheTagHelper1 = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2";

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var childContent2 = "different-content";
            var tagHelperContext2 = GetTagHelperContext(id);
            var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2);
            tagHelperOutput2.PreContent.SetContent("<cache>");
            tagHelperOutput2.PostContent.SetContent("</cache>");
            var cacheTagHelper2 = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresOnIsSet()
        {
            // Arrange
            var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4);
            var cache = new MemoryCache(new MemoryCacheOptions());
            var cacheTagHelper = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                ExpiresOn = expiresOn
            };

            // Act
            var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions();

            // Assert
            Assert.Equal(expiresOn, cacheEntryOptions.AbsoluteExpiration);
        }

        [Fact]
        public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresAfterIsSet()
        {
            // Arrange
            var expiresAfter = TimeSpan.FromSeconds(42);
            var cache = new MemoryCache(new MemoryCacheOptions());
            var cacheTagHelper = new CacheTagHelper(cache, new HtmlTestEncoder())
            {
                ExpiresAfter = expiresAfter
            };

            // Act
            var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions();

            // Assert
            Assert.Equal(expiresAfter, cacheEntryOptions.AbsoluteExpirationRelativeToNow);
        }

     
        
        private void InitializeComponent()
        {
            this.ucStatsOutput1 = new DF2DPipe.Stats.UC.UCPipeLineStatsOutput();
            this.SuspendLayout();
            // 
            // ucStatsOutput1
            // 
            this.ucStatsOutput1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.ucStatsOutput1.Location = new System.Drawing.Point(0, 0);
            this.ucStatsOutput1.Name = "ucStatsOutput1";
            this.ucStatsOutput1.Size = new System.Drawing.Size(597, 457);
            this.ucStatsOutput1.TabIndex = 0;
            // 
            // FrmPipeLineStatsOutput2D
            // 
            this.ClientSize = new System.Drawing.Size(597, 457);
            this.Controls.Add(this.ucStatsOutput1);
            this.MinimizeBox = false;
            this.Name = "FrmPipeLineStatsOutput2D";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "统计结果";
            this.ResumeLayout(false);

        }

        public void SetData(DataTable dt)
        {
            this.ucStatsOutput1.SetData(dt);
        }
        public void SetData1(DataTable dt)
        {
            this.ucStatsOutput1.SetData1(dt);
        }


        [Fact]
        public async Task ProcessAsync_DoesNotCache_IfDisabled()
        {
            // Arrange
            var childContent = "original-child-content";
            var storage = new Mock<IDistributedCacheTagHelperStorage>();
            var value = Encoding.UTF8.GetBytes("ok");
            storage.Setup(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()));
            storage.Setup(c => c.GetAsync(It.IsAny<string>()))
                .Returns(Task.FromResult(value));
            var tagHelperContext = GetTagHelperContext();
            var service = new DistributedCacheTagHelperService(
                storage.Object,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = false
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());
            storage.Verify(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*content*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()),
                Times.Never);
        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfEnabled()
        {
            // Arrange
            var childContent = "original-child-content";
            var storage = new Mock<IDistributedCacheTagHelperStorage>();
            var value = Encoding.UTF8.GetBytes(childContent);
            storage.Setup(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()));
            storage.Setup(c => c.GetAsync(It.IsAny<string>()))
                .Returns(Task.FromResult<byte[]>(null));
            var service = new DistributedCacheTagHelperService(
                storage.Object,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperContext = GetTagHelperContext();
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = true,
                Name = "some-name"
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Empty(tagHelperOutput.PreContent.GetContent());
            Assert.Empty(tagHelperOutput.PostContent.GetContent());
            Assert.True(tagHelperOutput.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());

            storage.Verify(c => c.GetAsync(
                /*key*/ It.IsAny<string>()
                ),
                Times.Once);

            storage.Verify(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ It.IsAny<byte[]>(),
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()),
                Times.Once);

        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfVaryByParamIsUnchanged()
        {
            // Arrange - 1
            var childContent = "original-child-content";
            var storage = GetStorage();
            var formatter = GetFormatter();
            var tagHelperContext1 = GetTagHelperContext();
            var tagHelperOutput1 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var service = new DistributedCacheTagHelperService(
                storage,
                formatter,
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var cacheTagHelper1 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                Enabled = true,
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var tagHelperContext2 = GetTagHelperContext();
            var tagHelperOutput2 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: "different-content");
            var cacheTagHelper2 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                Enabled = true,
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public async Task ProcessAsync_RecalculatesValueIfCacheKeyChanges()
        {
            // Arrange - 1
            var childContent1 = "original-child-content";
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperContext1 = GetTagHelperContext();
            var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1);
            tagHelperOutput1.PreContent.Append("<cache>");
            tagHelperOutput1.PostContent.SetContent("</cache>");
            var cacheTagHelper1 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2";

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var childContent2 = "different-content";
            var tagHelperContext2 = GetTagHelperContext();
            var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2);
            tagHelperOutput2.PreContent.SetContent("<cache>");
            tagHelperOutput2.PostContent.SetContent("</cache>");
            var cacheTagHelper2 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresOnIsSet()
        {
            // Arrange
            var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4);
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance
                );
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ExpiresOn = expiresOn
            };

            // Act
            var cacheEntryOptions = cacheTagHelper.GetDistributedCacheEntryOptions();

            // Assert
            Assert.Equal(expiresOn, cacheEntryOptions.AbsoluteExpiration);
        }

        [Fact]
        public void UpdateCacheEntryOptions_DefaultsTo30SecondsSliding_IfNoEvictionCriteriaIsProvided()
        {
            // Arrange
            var slidingExpiresIn = TimeSpan.FromSeconds(30);
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance
                );
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder());

            // Act
            var cacheEntryOptions = cacheTagHelper.GetDistributedCacheEntryOptions();

            // Assert
            Assert.Equal(slidingExpiresIn, cacheEntryOptions.SlidingExpiration);
        }


        [Fact]
        public async Task ProcessAsync_DoesNotCache_IfDisabled()
        {
            // Arrange
            var childContent = "original-child-content";
            var storage = new Mock<IDistributedCacheTagHelperStorage>();
            var value = Encoding.UTF8.GetBytes("ok");
            storage.Setup(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()));
            storage.Setup(c => c.GetAsync(It.IsAny<string>()))
                .Returns(Task.FromResult(value));
            var tagHelperContext = GetTagHelperContext();
            var service = new DistributedCacheTagHelperService(
                storage.Object,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = false
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());
            storage.Verify(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*content*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()),
                Times.Never);
        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfEnabled()
        {
            // Arrange
            var childContent = "original-child-content";
            var storage = new Mock<IDistributedCacheTagHelperStorage>();
            var value = Encoding.UTF8.GetBytes(childContent);
            storage.Setup(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ value,
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()));
            storage.Setup(c => c.GetAsync(It.IsAny<string>()))
                .Returns(Task.FromResult<byte[]>(null));
            var service = new DistributedCacheTagHelperService(
                storage.Object,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperContext = GetTagHelperContext();
            var tagHelperOutput = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ViewContext = GetViewContext(),
                Enabled = true,
                Name = "some-name"
            };

            // Act
            await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput);

            // Assert
            Assert.Empty(tagHelperOutput.PreContent.GetContent());
            Assert.Empty(tagHelperOutput.PostContent.GetContent());
            Assert.True(tagHelperOutput.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput.Content.GetContent());

            storage.Verify(c => c.GetAsync(
                /*key*/ It.IsAny<string>()
                ),
                Times.Once);

            storage.Verify(c => c.SetAsync(
                /*key*/ It.IsAny<string>(),
                /*value*/ It.IsAny<byte[]>(),
                /*options*/ It.IsAny<DistributedCacheEntryOptions>()),
                Times.Once);

        }

        [Fact]
        public async Task ProcessAsync_ReturnsCachedValue_IfVaryByParamIsUnchanged()
        {
            // Arrange - 1
            var childContent = "original-child-content";
            var storage = GetStorage();
            var formatter = GetFormatter();
            var tagHelperContext1 = GetTagHelperContext();
            var tagHelperOutput1 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: childContent);
            var service = new DistributedCacheTagHelperService(
                storage,
                formatter,
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var cacheTagHelper1 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                Enabled = true,
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var tagHelperContext2 = GetTagHelperContext();
            var tagHelperOutput2 = GetTagHelperOutput(
                attributes: new TagHelperAttributeList(),
                childContent: "different-content");
            var cacheTagHelper2 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                Enabled = true,
                VaryByQuery = "key1,key2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.QueryString = new QueryString(
                "?key1=value1&key2=value2");

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public async Task ProcessAsync_RecalculatesValueIfCacheKeyChanges()
        {
            // Arrange - 1
            var childContent1 = "original-child-content";
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance);
            var tagHelperContext1 = GetTagHelperContext();
            var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1);
            tagHelperOutput1.PreContent.Append("<cache>");
            tagHelperOutput1.PostContent.SetContent("</cache>");
            var cacheTagHelper1 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2";

            // Act - 1
            await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1);

            // Assert - 1
            Assert.Empty(tagHelperOutput1.PreContent.GetContent());
            Assert.Empty(tagHelperOutput1.PostContent.GetContent());
            Assert.True(tagHelperOutput1.IsContentModified);
            Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent());

            // Arrange - 2
            var childContent2 = "different-content";
            var tagHelperContext2 = GetTagHelperContext();
            var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2);
            tagHelperOutput2.PreContent.SetContent("<cache>");
            tagHelperOutput2.PostContent.SetContent("</cache>");
            var cacheTagHelper2 = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                VaryByCookie = "cookie1,cookie2",
                ViewContext = GetViewContext(),
            };
            cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";

            // Act - 2
            await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2);

            // Assert - 2
            Assert.Empty(tagHelperOutput2.PreContent.GetContent());
            Assert.Empty(tagHelperOutput2.PostContent.GetContent());
            Assert.True(tagHelperOutput2.IsContentModified);
            Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent());
        }

        [Fact]
        public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresOnIsSet()
        {
            // Arrange
            var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4);
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance
                );
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder())
            {
                ExpiresOn = expiresOn
            };

            // Act
            var cacheEntryOptions = cacheTagHelper.GetDistributedCacheEntryOptions();

            // Assert
            Assert.Equal(expiresOn, cacheEntryOptions.AbsoluteExpiration);
        }

        [Fact]
        public void UpdateCacheEntryOptions_DefaultsTo30SecondsSliding_IfNoEvictionCriteriaIsProvided()
        {
            // Arrange
            var slidingExpiresIn = TimeSpan.FromSeconds(30);
            var storage = GetStorage();
            var service = new DistributedCacheTagHelperService(
                storage,
                Mock.Of<IDistributedCacheTagHelperFormatter>(),
                new HtmlTestEncoder(),
                NullLoggerFactory.Instance
                );
            var cacheTagHelper = new DistributedCacheTagHelper(
                service,
                new HtmlTestEncoder());

            // Act
            var cacheEntryOptions = cacheTagHelper.GetDistributedCacheEntryOptions();

            // Assert
            Assert.Equal(slidingExpiresIn, cacheEntryOptions.SlidingExpiration);
        }

SharpDX.DXGI.Output1 : IDisposable, ICallbackable, IUnknown

Constructors :

public Output1(IntPtr nativePtr = )

Methods :

public ModeDescription1[] GetDisplayModeList1(Format enumFormat = , DisplayModeEnumerationFlags flags = )
public static Output1 op_Explicit(IntPtr nativePtr = )
public Void FindClosestMatchingMode1(ModeDescription1& modeToMatchRef = , ModeDescription1& closestMatchRef = , IUnknown concernedDeviceRef = )
public Void GetDisplaySurfaceData1(Resource destinationRef = )
public OutputDuplication DuplicateOutput(IUnknown deviceRef = )
public Void GetClosestMatchingMode(ComObject device = , ModeDescription modeToMatch = , ModeDescription& closestMatch = )
public ModeDescription[] GetDisplayModeList(Format format = , DisplayModeEnumerationFlags flags = )
public OutputDescription get_Description()
public GammaControlCapabilities get_GammaControlCapabilities()
public GammaControl get_GammaControl()
public Void set_GammaControl(GammaControl value = )
public FrameStatistics get_FrameStatistics()
public Void WaitForVerticalBlank()
public Void TakeOwnership(IUnknown deviceRef = , RawBool exclusive = )
public Void ReleaseOwnership()
public Void SetDisplaySurface(Surface scanoutSurfaceRef = )
public Void CopyDisplaySurfaceTo(Surface destinationRef = )
public T GetParent()
public Void SetPrivateData(Guid name = , Int32 dataSize = , IntPtr dataRef = )
public Void SetPrivateDataInterface(Guid name = , IUnknown unknownRef = )
public Result GetPrivateData(Guid name = , Int32& dataSizeRef = , IntPtr dataRef = )
public Void GetParent(Guid riid = , IntPtr& parentOut = )
public Void QueryInterface(Guid guid = , IntPtr& outPtr = )
public IntPtr QueryInterfaceOrNull(Guid guid = )
public T QueryInterface()
public T QueryInterfaceOrNull()
public Object get_Tag()
public Void set_Tag(Object value = )
public IntPtr get_NativePointer()
public Void set_NativePointer(IntPtr value = )
public Void add_Disposing(EventHandler<EventArgs> value = )
public Void remove_Disposing(EventHandler<EventArgs> value = )
public Void add_Disposed(EventHandler<EventArgs> value = )
public Void remove_Disposed(EventHandler<EventArgs> value = )
public Boolean get_IsDisposed()
public Void Dispose()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()