Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
            }
        }