public void やっていいことわるいこと() { using (var cache = new DppCache()) { Assert.Throws<InvalidOperationException>(cache.PullSync); Assert.Throws<InvalidOperationException>(cache.PushSync); Assert.Throws<InvalidOperationException>(cache.ClearSpectrum); Assert.Throws<InvalidOperationException>(cache.StartAutoSyncing); Assert.Throws<InvalidOperationException>(cache.StartMeasurement); Assert.DoesNotThrow(cache.StopAutoSyncing); Assert.Throws<InvalidOperationException>(cache.StopMeasurement); Assert.DoesNotThrow(cache.StopControl); cache.StartControl("D2XX0"); Assert.DoesNotThrow(cache.PullSync); Assert.DoesNotThrow(cache.PushSync); Assert.DoesNotThrow(cache.ClearSpectrum); Assert.DoesNotThrow(cache.StartAutoSyncing); Assert.DoesNotThrow(cache.StartMeasurement); Assert.DoesNotThrow(cache.StopAutoSyncing); Assert.DoesNotThrow(cache.StopMeasurement); cache.StopControl(); Assert.Throws<InvalidOperationException>(cache.PullSync); Assert.Throws<InvalidOperationException>(cache.PushSync); Assert.Throws<InvalidOperationException>(cache.ClearSpectrum); Assert.Throws<InvalidOperationException>(cache.StartAutoSyncing); Assert.Throws<InvalidOperationException>(cache.StartMeasurement); Assert.DoesNotThrow(cache.StopAutoSyncing); Assert.Throws<InvalidOperationException>(cache.StopMeasurement); Assert.DoesNotThrow(cache.StopControl); } }
public DppViewModel() { cache = new DppCache(); cache.PropertyChanged += OnCacheStatusChanged; CompositeDisposable.Add(cache); parameterSet = new ParameterSet(); parameterSet.ForEach(p => cache.Parameters.Add(p)); }
public void Dispose後にStartControlは不可() { var cache = new DppCache(); try { cache.StartControl("D2XX0"); Assert.IsTrue(cache.IsConnected); cache.Dispose(); Assert.IsFalse(cache.IsConnected); Assert.Throws<InvalidOperationException>(() => cache.StartControl("D2XX0")); Assert.IsFalse(cache.IsConnected); } finally { cache.Dispose(); } }
public void StartControl後にStopControl() { using (var cache = new DppCache()) { Assert.IsFalse(cache.IsConnected); cache.StartControl("D2XX0"); Assert.IsTrue(cache.IsConnected); Assert.IsFalse(cache.IsAutoSyncing); cache.StartAutoSyncing(); Assert.IsTrue(cache.IsAutoSyncing); cache.StopControl(); Assert.IsFalse(cache.IsConnected); Assert.IsFalse(cache.IsAutoSyncing); } }