private void CallDeviceMethods(FilterWheel filterWheel)
        {
            Logger.LogInformation("START CallDeviceMethods");

            Logger.LogInformation("Connect Filter wheel");
            filterWheel.SetConnected(true);

            var isConnected = filterWheel.IsConnected();

            Logger.LogInformation("is Connected : {Connected}", isConnected);

            var name = filterWheel.GetName();

            Logger.LogInformation("Name : {Name}", name);

            var description = filterWheel.GetDescription();

            Logger.LogInformation("Description : {Description}", description);

            var driverInfo = filterWheel.GetDriverInfo();

            Logger.LogInformation("DriverInfo : {DriverInfo}", driverInfo);

            var driverVersion = filterWheel.GetDriverVersion();

            Logger.LogInformation("DriverVersion : {DriverVersion}", driverVersion);

            var names = filterWheel.GetNames();

            Logger.LogInformation("Filter names : {Names}", names);

            var offsets = filterWheel.GetFocusOffsets();

            Logger.LogInformation("Filter offsets : {Offsets}", offsets);

            var position = filterWheel.GetPosition();

            Logger.LogInformation("Current position : {Position}", position);

            Logger.LogInformation("Set filter position");
            filterWheel.SetPosition(2);

            position = filterWheel.GetPosition();
            Logger.LogInformation("Current position : {Position}", position);

            try
            {
                filterWheel.SetPosition(1000);
            }
            catch (Exception e)
            {
                Logger.LogError(e, e.Message);
            }

            Logger.LogInformation("END CallDeviceMethods");
        }
Ejemplo n.º 2
0
        public void GetName_SendValidRequest()
        {
            //Arrange
            string       commandName       = "name";
            IRestRequest sentRequest       = null;
            var          commandSenderMock = new Mock <ICommandSender>();

            commandSenderMock
            .Setup(x => x.ExecuteRequest <StringResponse>(It.IsAny <string>(), It.IsAny <RestRequest>()))
            .Callback((string baseUrl, IRestRequest request) => sentRequest = request)
            .Returns(new StringResponse("test"));
            var device = new FilterWheel(_deviceConfiguration, commandSenderMock.Object);

            //Act
            device.GetName();

            //Assert
            Assert.Equal(Method.GET, sentRequest.Method);
            AssertCommonParameters(sentRequest.Parameters, _deviceConfiguration, commandName);
        }