Exemplo n.º 1
0
        public void TestSearchWithHeater()
        {
            SerialPortFake spHeater = new SerialPortFake("Port 1");
            spHeater.setupResponse((count) => { return new byte[] { SerialSearcher.magicResponse }; });

            ISerialPortFactory spf = new MaBoHe.Fakes.StubISerialPortFactory()
            {
                GetPortNames = () => { return new string[] { "Port 1" }; },
                CreateString = (name) => { if (name == "Port 1") return spHeater; else return null; }
            };

            SerialSearcher search = new SerialSearcher(spf);

            Assert.AreEqual(spHeater, search.searchHeater());
        }
Exemplo n.º 2
0
        public void TestSearchWithNoHeater()
        {
            ISerialPort spNoHeater = new MaBoHe.Fakes.StubISerialPort()
            {
                PortNameGet = () => "Port 1",
                ReadBytesInt32 = (count) => { return new byte[] { 5, 6 }; }
            };

            ISerialPortFactory spf = new MaBoHe.Fakes.StubISerialPortFactory()
            {
                GetPortNames = () => { return new string[] { "Port 1" }; },
                CreateString = (name) => { if (name == "Port 1") return spNoHeater; else return null; }
            };

            SerialSearcher search = new SerialSearcher(spf);

            Assert.IsNull(search.searchHeater());
        }
Exemplo n.º 3
0
 public SerialConn(SerialSearcher searcher)
 {
     this.searcher = searcher;
 }