public void MultipleSubsystemsGeneratedByMultipleAttributes()
 {
     using (AttributedRobot robot = new AttributedRobot())
     {
         robot._RobotInit();
         Assert.AreEqual(2, robot.Subsystems.OfType<BSubsystem>().Count());
     }
 }
 public void SubsystemSetsDefaultCommandByAttributeThroughReflectionContext()
 {
     using (AttributedRobot robot = new AttributedRobot(new TestReflectionContext()))
     {
         robot._RobotInit();
         Assert.IsTrue(robot.Subsystems.OfType<ASubsystem>().Any());
         Scheduler.Instance.Run();
         Assert.IsInstanceOf<MockCommand>(robot.Subsystems.OfType<ASubsystem>().First().GetCurrentCommand());
     }
 }
 public void CommandsRegisteredForTestStartOnTest()
 {
     using (AttributedRobot robot = new AttributedRobot(new TestReflectionContext()))
     {
         robot._RobotInit();
         robot._TestInit();
         robot._TestPeriodic();
         foreach (var command in robot.PhaseCommands[MatchPhase.Test])
         {
             Assert.IsTrue(command.IsRunning());
         }
     }
 }
 public void WhenPressed()
 {
     using (var robot = new AttributedRobot())
    {
         DriverStationHelper.SetJoystickButton(0, 1, false);
         Thread.Sleep(40);
         robot._RobotInit();
         robot._TeleopInit();
         robot._TeleopPeriodic();
         Assert.IsFalse(s_commandStarted, "Command has not started");
         DriverStationHelper.SetJoystickButton(0, 1, true);
         Thread.Sleep(40);
         robot._TeleopPeriodic();
         robot._TeleopPeriodic();
         Assert.IsTrue(s_commandStarted, "Command has started");
     }
 }