Exemplo n.º 1
0
            public void Compass_Should_Change_Heading()
            {
                // Given
                var                  testScheduler = new TestScheduler();
                CompassData          reading       = new CompassData();
                MockCompassEssential compass       = new MockCompassEssentialFixture().WithScheduler(testScheduler);

                compass
                .CompassChanged
                .Subscribe(_ =>
                {
                    reading = _.Reading;
                });

                // When
                testScheduler.AdvanceToMs(TimeSpan.FromSeconds(1).TotalMilliseconds);

                // Then
                reading.HeadingMagneticNorth.Should().Be(0);

                // When
                testScheduler.AdvanceBy(TimeSpan.FromSeconds(1).Ticks);

                // Then
                reading.HeadingMagneticNorth.Should().Be(10);

                // When
                testScheduler.AdvanceBy(TimeSpan.FromSeconds(1).Ticks);

                // Then
                reading.HeadingMagneticNorth.Should().Be(20);
            }
Exemplo n.º 2
0
            public void Should_Be_Monitoring()
            {
                // Given
                MockCompassEssential compass = new MockCompassEssentialFixture();

                // When
                compass.Start();

                // The
                compass.IsMonitoring.Should().BeTrue();
            }