public void TestOneshotFlag() { var val = new AutoResetFlag(true); Assert.IsTrue(val.Peek()); Assert.IsTrue(val.Read()); Assert.IsTrue(!val.Peek()); Assert.IsTrue(!val.Read()); Assert.IsTrue(!val.Peek()); val.Set(); Assert.IsTrue(val.Peek()); Assert.IsTrue(val.Read()); Assert.IsTrue(!val.Peek()); Assert.IsTrue(!val.Read()); Assert.IsTrue(!val.Peek()); val = new AutoResetFlag(false); Assert.IsTrue(!val.Peek()); Assert.IsTrue(!val.Read()); Assert.IsTrue(!val.Peek()); val.Set(); Assert.IsTrue(val.Peek()); Assert.IsTrue(val.Read()); Assert.IsTrue(!val.Peek()); Assert.IsTrue(!val.Read()); Assert.IsTrue(!val.Peek()); }
/// <summary> /// Create a new builder with the defined scope /// </summary> /// <param name="scope"></param> public RegexBuilder(RegexScope scope = RegexScope.Anywhere) { this.negate = new AutoResetFlag(false); this.scope = scope; }