示例#1
0
        public async Task TestConnectComException()
        {
            _mockFocuserProvider.Setup(m => m.GetFocuser(It.IsAny <string>()))
            .Throws(new System.Runtime.InteropServices.COMException());
            var sut = new AscomFocuser(ID, NAME)
            {
                FocuserProvider = _mockFocuserProvider.Object
            };
            var result = await sut.Connect(new CancellationToken());

            Assert.That(result, Is.False);
        }
示例#2
0
        public async Task TestConnectException()
        {
            _mockFocuserProvider.Setup(m => m.GetFocuser(It.IsAny <string>(), true))
            .Throws(new Exception());
            var sut = new AscomFocuser(ID, NAME)
            {
                FocuserProvider = _mockFocuserProvider.Object
            };
            var result = await sut.Connect(new CancellationToken());

            Assert.That(result, Is.False);
        }
示例#3
0
        public async Task Init()
        {
            _mockFocuserProvider = new Mock <IAscomFocuserProvider>();
            _mockFocuser         = new Mock <IFocuserV3>();
            _mockFocuser.SetupProperty(m => m.Connected, false);
            _mockFocuserProvider.Setup(m => m.GetFocuser(It.IsAny <string>())).Returns(_mockFocuser.Object);
            _sut = new AscomFocuser(ID, NAME)
            {
                FocuserProvider = _mockFocuserProvider.Object
            };
            var result = await _sut.Connect(new CancellationToken());

            Assert.That(result, Is.True);
        }