示例#1
0
 public void HasChangeFiresChange()
 {
     var token = new TestChangeToken();
     bool fired = false;
     ChangeToken.OnChange(() => token, () => fired = true);
     Assert.False(fired);
     token.Changed();
     Assert.True(fired);
 }
示例#2
0
        public void HasChangeFiresChange()
        {
            var  token = new TestChangeToken();
            bool fired = false;

            ChangeToken.OnChange(() => token, () => fired = true);
            Assert.False(fired);
            token.Changed();
            Assert.True(fired);
        }
示例#3
0
 public void HasChangeFiresChangeWithState()
 {
     var token = new TestChangeToken();
     object state = new object();
     object callbackState = null;
     ChangeToken.OnChange(() => token, s => callbackState = s, state);
     Assert.Null(callbackState);
     token.Changed();
     Assert.Equal(state, callbackState);
 }
示例#4
0
        public void HasChangeFiresChangeWithState()
        {
            var    token         = new TestChangeToken();
            object state         = new object();
            object callbackState = null;

            ChangeToken.OnChange(() => token, s => callbackState = s, state);
            Assert.Null(callbackState);
            token.Changed();
            Assert.Equal(state, callbackState);
        }