示例#1
0
        public void TestToucan()
        {
            Toucan toucan = new Toucan();

            Assert.Equal("Toucans don't live in the Amazon!", toucan.TropicalHabitat);
            Assert.False(toucan.ColorfulPlumage);
        }
        /// <param name="ip">The IP address of the 2CAN.</param>
        public SimpleCrosslinkRobot(IPAddress ip)
        {
            toucan = new Toucan(ip);
            battery = new AnalogInput(toucan, 8);

            timer = new Timer(50);
            timer.Elapsed += new ElapsedEventHandler(periodic);
            timer.Enabled = true;
        }
        static void OverrideAbstractProperties()
        {
            Toucan toucan = new Toucan();

            Console.WriteLine($"A toucan has colorful plumage: {toucan.ColorfulPlumage}");
            Console.WriteLine($"{toucan.TropicalHabitat}");
            Parrot parrot = new Parrot();

            Console.WriteLine($"A parrot has colorful plumage: {parrot.ColorfulPlumage}");
            Console.WriteLine($"{parrot.TropicalHabitat}");
        }
        static void OverrideVirtualMethods()
        {
            // Override two virtual methods
            // Create animal objects and instantiate concrete animals
            Parrot parrot = new Parrot();

            Console.WriteLine(parrot.Fly());
            Toucan toucan = new Toucan();

            Console.WriteLine(toucan.Fly());

            Krill krill = new Krill();

            Console.WriteLine(krill.BeEaten());
            Langostino langostino = new Langostino();

            Console.WriteLine(langostino.BeEaten());
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the AnalogInput class for the specified 2CAN and input channel.
 /// </summary>
 /// <param name="toucan">The Toucan instance associated with this analog input</param>
 /// <param name="channel">The CANipede channel used (1-8).</param>
 public AnalogInput(Toucan toucan, int channel)
 {
     this.toucan = toucan;
     this.channel = channel;
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the GPIO class for the specified 2CAN and GPIO channel.
 /// </summary>
 /// <param name="toucan">The 2CAN instance associated with this digital input</param>
 /// <param name="channel">The GPIO channel used (1-4).</param>
 public GPIO(Toucan toucan, int channel)
 {
     this.toucan = toucan;
     this.channel = channel;
 }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the Encoder class for the specified 2CAN and input channel.
 /// </summary>
 /// <param name="toucan">The Toucan instance associated with this Encoder</param>
 /// <param name="channel">The QUAD input in use (1-4).</param>
 public Encoder(Toucan toucan, int channel)
 {
     this.toucan = toucan;
     this.channel = channel;
 }
示例#8
0
        public void TestSleep()
        {
            Toucan toucan = new Toucan();

            Assert.Equal("Zzzzzz. Animals sleep!", toucan.Sleep);
        }