Beispiel #1
0
        public async Task TestMethod1()
        {
            var hueController = new HueController();
            await hueController.Init();

            await hueController.SetToColor("FFFFFF");
        }
Beispiel #2
0
        public void SetLampColorAsync_SetsTheLampColor()
        {
            // Arrange
            string lightId                = "lightId221";
            string expectedColor          = _red;
            IEnumerable <Light> lightList = new List <Light>()
            {
                new Light()
                {
                    UniqueId = lightId
                }
            };

            _loggerMock.Setup(m => m.Information(It.Is <string>(a => a.Contains(lightId) && a.Contains(expectedColor))));
            _hueClientMock.Setup(m => m.GetLightsAsync()).Returns(Task.FromResult(lightList));

            var hueController = new HueController(_loggerMock.Object, _configMock.Object, _hueClientMock.Object);

            //Act
            var result = hueController.SetLampColorAsync(expectedColor, lightId);

            //Assert
            Assert.IsNotNull(result);
            _loggerMock.Verify(m => m.Information(It.Is <string>(a => a.Contains(lightId) && a.Contains(expectedColor))), Times.Once);
        }
        public void SetLampColorAsync_SetsTheLampColor()
        {
            // Arrange
            string uniqueId               = "lightId221";
            string lightId                = "1";
            string expectedColor          = _red;
            IEnumerable <Light> lightList = new List <Light>()
            {
                new Light()
                {
                    UniqueId = uniqueId, Id = lightId
                }
            };

            RGBColor rgbColor = new RGBColor(expectedColor);
            var      command  = new LightCommand();

            command.TurnOn().SetColor(rgbColor);

            _loggerMock.Setup(m => m.Information(It.Is <string>(a => a.Contains(uniqueId) && a.Contains(expectedColor))));
            _hueClientMock.Setup(m => m.GetLightsAsync()).Returns(Task.FromResult(lightList));
            _hueClientMock.Setup(m => m.SendCommandAsync(It.IsAny <LightCommand>(), It.Is <IEnumerable <string> >(lc => lc.Contains(lightId))));

            var hueController = new HueController(_loggerMock.Object, _configMock.Object, _hueClientMock.Object);

            //Act
            var result = hueController.SetLampColorAsync(expectedColor, uniqueId);

            //Assert
            Assert.IsNotNull(result);
            _loggerMock.Verify(m => m.Information(It.Is <string>(a => a.Contains(uniqueId) && a.Contains(expectedColor))), Times.Once);
            _hueClientMock.Verify(m => m.SendCommandAsync(It.IsAny <LightCommand>(), It.Is <IEnumerable <string> >(lc => lc.Contains(lightId))), Times.Once);
        }
        public Demo()
        {
            InitializeComponent();

            // variable initialization
            isPointed = false;
            checkedButton = false;
            paused = false;
            counterFrames = 0;
            counterFramesBody = 0;
            mainHandId = 0;
            PointerMovedAssigned = false;
            MediaEndedAssigned = false;

            relatedBackup = null;

            // object initialization
            IdleAnimateFirstHand();
            kc = new KinectController();
            hue = new HueController("192.168.0.2");
            hue.Connect();
            hue.isBright = true;
            kc.bodyReader.FrameArrived += HandleFrame;

            idle = new DemoIdle();
            this.contentControl.Content = idle;
            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);
            app.KinectRegion = kinectRegion;

            windowProducts = new SortedList<int, Model.Product>();
            db = new DbFileManager();

            state = 1;

            playimage = new BitmapImage(new Uri("Images\\play.png", UriKind.Relative));
            pauseimage = new BitmapImage(new Uri("Images\\pause.png", UriKind.Relative));

            InitProducts();

            idle.label.Opacity = 0;

            kWin = KinectCoreWindow.GetForCurrentThread();
            if (!PointerMovedAssigned)
            {
                kWin.PointerMoved += KWin_PointerMoved;
                kWin.PointerExited += KWin_PointerExited;
                kWin.PointerEntered += KWin_PointerEntered;
                PointerMovedAssigned = true;
            }

            /*
            this.MouseMove += Demo_MouseMove;

            currentProduct = 1;
            StartTrailer(windowProducts[currentProduct].GetTrailer());
            isPointed = true;*/
        }
 public HueDebug()
 {
     InitializeComponent();
     if (HueReference == null)
     {
         HueReference = this;
     }
     hueControl = null;
 }
Beispiel #6
0
 static void Main(string[] args)
 {
     HueController controller = new HueController();
     controller.TurnOnLights();
     controller.SetColor(Color.White);
     Console.ReadKey();
     controller.PartyMode(10).Wait();
     Console.ReadKey();
     controller.TurnOffLights();
     Console.ReadKey();
 }
Beispiel #7
0
        private static void Main()
        {
            var controller = new HueController();

            Task.Run(controller.Init).Wait();

            var mapRepository = new MapRepository(new Uri("https://leuven.pokehunt.me"));
            var hueBatch      = new HueBatch(mapRepository, controller);

            Task.Run(hueBatch.Start).Wait();
        }
 private void connectButton(object sender, RoutedEventArgs e)
 {
     if (hueControl == null)
     {
         hueControl = new HueController("192.168.0.2");
     }
     try
     {
         hueControl.Connect();
     } catch (Exception ex)
     {
         this.textBlock.Text += ex.Message + "\n";
     }
 }
Beispiel #9
0
        public void GetTrafficColor_TravelTimeIs10MinSlowerAsDefaultTravelTime_ReturnsRed()
        {
            // Arrange
            int    currentTravelTime = 50;
            int    defaultTravelTime = 40;
            string expectedColor     = _red;
            var    hueController     = new HueController(_loggerMock.Object, _configMock.Object, _hueClientMock.Object);

            //Act
            var result = hueController.GetTrafficColor(currentTravelTime, defaultTravelTime);

            //Assert
            Assert.AreEqual(expectedColor, result);
        }