コード例 #1
0
 public void MultipleSubsystemsGeneratedByMultipleAttributes()
 {
     using (AttributedRobot robot = new AttributedRobot())
     {
         robot._RobotInit();
         Assert.AreEqual(2, robot.Subsystems.OfType<BSubsystem>().Count());
     }
 }
コード例 #2
0
 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());
     }
 }
コード例 #3
0
 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());
         }
     }
 }
コード例 #4
0
 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");
     }
 }