Skip to content

Instantly share code, notes, and snippets.

@ionoy
Created March 19, 2015 06:38
Show Gist options
  • Save ionoy/b50e89a936e38a648ee7 to your computer and use it in GitHub Desktop.
Save ionoy/b50e89a936e38a648ee7 to your computer and use it in GitHub Desktop.
new TestScheduler().With(sc => {
var client = Substitute.For<IQuadClient>();
var packets = new Subject<IMavLinkPacket>();
client.Packets.Returns(packets);
var quad = new Quad(client, MessageBus.Current);
packets.OnNext(new Mav.mavlink_heartbeat_t { base_mode = (byte)Mav.MAV_MODE_FLAG.SAFETY_ARMED });
sc.AdvanceByMs(1);
quad.State = new LandState();
sc.AdvanceByMs(1);
Assert.AreEqual(ArduCopterMode.Land, quad.DesiredMode);
Assert.AreEqual(1000, quad.RcOverride.Throttle);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment