コード例 #1
0
        public void OpenTest()
        {
            var mock = new Moq.Mock<IMyDriver>();
            var client = new MyWork.MyConnection(new[] {mock.Object});
            mock.Setup(driver => driver.Connect());

            client.Open();

            mock.VerifyAll();
        }
コード例 #2
0
        public void CloseTest()
        {
            var mock = new Mock<IMyDriver>();
            var client = new MyConnection(new[] {mock.Object});
            mock.Setup(driver => driver.Close());

            client.Close();

            mock.VerifyAll();
        }
コード例 #3
0
        public void OpenTest()
        {
            var mock   = new Moq.Mock <IMyDriver>();
            var client = new MyWork.MyConnection(new[] { mock.Object });

            mock.Setup(driver => driver.Connect());

            client.Open();

            mock.VerifyAll();
        }
コード例 #4
0
        public void ConnectedTest()
        {
            var mock = new Mock<IMyDriver>();
            var client = new MyConnection(new[] {mock.Object});
            bool flag = false;
            client.Connected += (sender, args) => flag = true;

            client.Open();

            Assert.IsTrue(flag);
        }