예제 #1
0
        public async Task MoveCarouse__TransactionQueue_DeviceResponse_CarWhiteTB1470H_Positive()
        {
            //Assume
            IDeviceResponse expected = new DeviceResponse()
            {
                HasError = false
            };
            CarouselFactory carouselFactory    = new CarouselFactory();
            Utility         utility            = new Utility();
            CarouselManager objCarouselManager = new CarouselManager(_configuration, _logger.Object, carouselFactory, _socket.Object, _deviceResponse.Object);

            TransactionData data   = CreateTransactionQueueData();
            Device          device = data.Devices.FirstOrDefault(dev => dev.Type.Equals("Carousel"));

            device.Attribute.DeviceClass = ControllerType.WhiteTB1470H.ToString().ToUpper();
            await objCarouselManager.CreateCarousel(data);

            Slot slot = await utility.BuildStorageSpaceItem(device.StorageSpaces);

            //Act
            IDeviceResponse actual = await objCarouselManager.MoveCarousel(data, slot);

            //Assert
            Assert.Equal(expected.HasError, actual.HasError);
        }
예제 #2
0
        public async Task CreateCarousel_TransactionQueue_shouldCreateCarWhiteTB1470Carousel_Positive()
        {
            //Arrange
            TransactionData objTransactionData = CreateTransactionQueueData();
            Device          _carouselData      = objTransactionData.Devices.FirstOrDefault(dev => dev.Type.Equals("Carousel"));

            _carousel = new CarWhiteTB1470H(controlType: ControllerType.WhiteTB1470, ipAddr: _carouselData.Attribute.IPAddress, carAddr: _carouselData.Attribute.DeviceNumber,
                                            port: _carouselData.Attribute.Port, TimeOut: 10, returnsStatus: true, deviceResponse: _deviceResponse.Object, socket: _socket.Object);

            _carouselFactory.Setup(x => x.GetCarouselType(_carouselData, It.IsAny <IDeviceResponse>(), It.IsAny <IIPSocket>(), It.IsAny <string>())).Returns(Task.FromResult(_carousel));
            CarouselManager objCarouselManager = new CarouselManager(_configuration, _logger.Object, _carouselFactory.Object, _socket.Object, _deviceResponse.Object);

            //Act
            IDeviceResponse deviceResponse = await objCarouselManager.CreateCarousel(objTransactionData);

            //Assert
            Assert.False(deviceResponse.HasError);
        }
예제 #3
0
        public async Task CreateCarousel_TransactionQueue_shouldCreateWhiteIPCDualAccessCarousel_Negative()
        {
            //Arrange
            TransactionData objTransactionData = CreateTransactionQueueData();
            Device          _carouselData      = objTransactionData.Devices.FirstOrDefault(dev => dev.Type.Equals("Carousel"));

            _carousel = null;
            IDeviceResponse divDeviceResponse = new DeviceResponse();

            _carouselFactory.Setup(x => x.GetCarouselType(_carouselData, It.IsAny <IDeviceResponse>(), It.IsAny <IIPSocket>(), It.IsAny <string>())).Returns(Task.FromResult(_carousel));
            CarouselManager objCarouselManager = new CarouselManager(_configuration, _logger.Object, _carouselFactory.Object, _socket.Object, divDeviceResponse);

            //Act
            IDeviceResponse deviceResponse = await objCarouselManager.CreateCarousel(objTransactionData);

            //Assert
            Assert.True(deviceResponse.HasError);
        }