public void ApplyWithAction( ConditionMonitor sut ) { var count = 0; Assert.True( sut.Apply( () => count++ ) ); Assert.Equal( 1, count ); Assert.False( sut.Apply( () => count++ ) ); Assert.Equal( 1, count ); }
public void Apply( ConditionMonitor sut ) { Assert.False( sut.State == ConditionMonitorState.Applied ); var applied = sut.Apply(); Assert.True( applied ); Assert.True( sut.State == ConditionMonitorState.Applied ); Assert.False( sut.Apply() ); sut.Reset(); Assert.False( sut.State == ConditionMonitorState.Applied ); }
public InnerContent(IInnerContent content, ConditionMonitor monitor, bool apply) { _content = content; _monitor = monitor; if (apply) { monitor.Apply(); } }
public IInnerContent Get(IFormatReader parameter) { var monitor = new ConditionMonitor(); if (_apply) { monitor.Apply(); } var result = new InnerContent(_activator.Get(parameter), monitor); return(result); }
public bool MoveNext() => _content.MoveNext() || _monitor.Apply();