public void TestContracts() { ISensorFusion fusion = Factory.CreateSensorFusion(); fusion.Dispose(); fusion.IsDisposed.Should().BeTrue(); fusion.Dispose(); //< Must be allowed // // Get // new Action(() => { var unused = fusion.IsAttachedToSensor; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.IsGravityEnabled; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.IsPredictionEnabled; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.Orientation; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.PredictedOrientation; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.PredictionTime; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.YawMultiplier; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.AccelGain; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.Acceleration; }).ShouldThrow <ObjectDisposedException>(); new Action(() => { var unused = fusion.AngularVelocity; }).ShouldThrow <ObjectDisposedException>(); // // Set // new Action(() => fusion.AccelGain = 1.5f).ShouldThrow <ObjectDisposedException>(); new Action(() => fusion.YawMultiplier = 1.5f).ShouldThrow <ObjectDisposedException>(); new Action(() => fusion.IsPredictionEnabled = true).ShouldThrow <ObjectDisposedException>(); new Action(() => fusion.PredictionTime = TimeSpan.FromDays(1)).ShouldThrow <ObjectDisposedException>(); new Action(fusion.Reset).ShouldThrow <ObjectDisposedException>(); }
public void Dispose() { Fusion.Dispose(); Sensor.Dispose(); Device.Dispose(); }