Ejemplo n.º 1
0
        public void ShouldConstructWithCorrectDeviceIdWhenValid()
        {
            var deviceId = Devices.BladeStealth;
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);

            Assert.AreEqual(deviceId, device.DeviceId);
        }
Ejemplo n.º 2
0
        public async Task ShouldCallEffectApiWithCorrectDataOnClear()
        {
            var deviceId = Devices.Firefly;
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);
            await device.ClearAsync();

            _api.Verify(a => a.CreateDeviceEffectAsync(It.IsAny <Guid>(), It.IsAny <EffectType>(), default(NoneEffect)));
        }
Ejemplo n.º 3
0
        public async Task ShouldCallEffectApiWithCorrectEffectOnClear()
        {
            var deviceId = Devices.BlackwidowXTe;
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);
            await device.ClearAsync();

            _api.Verify(a => a.CreateDeviceEffectAsync(It.IsAny <Guid>(), EffectType.None, It.IsAny <NoneEffect>()), Times.Once);
        }
Ejemplo n.º 4
0
        public async Task SetEffectOverloadShouldCreateEffectWithCorrectEffect()
        {
            var deviceId = Devices.Diamondback;
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);

            await device.SetEffectAsync(EffectType.Reserved);

            _api.Verify(a => a.CreateDeviceEffectAsync(deviceId, EffectType.Reserved, IntPtr.Zero), Times.Once);
        }
Ejemplo n.º 5
0
        public async Task SetEffectOverloadShouldCreateEffectWithZeroData()
        {
            var deviceId = Devices.BlackwidowTe;
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);

            await device.SetEffectAsync(EffectType.None);

            _api.Verify(a => a.CreateDeviceEffectAsync(deviceId, EffectType.None, IntPtr.Zero), Times.Once);
        }
Ejemplo n.º 6
0
        public async Task ShouldCreateEffectWithCorrectEffectOnSetEffect()
        {
            var deviceId = Devices.Tartarus;
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);

            await device.SetEffectAsync(EffectType.None, default(NoneEffect));

            _api.Verify(a => a.CreateDeviceEffectAsync(It.IsAny <Guid>(), EffectType.None, It.IsAny <NoneEffect>()), Times.Once);
        }
Ejemplo n.º 7
0
        public async Task ShouldReturnCorrectEffectIdOnSetEffect()
        {
            var deviceId = Devices.Orochi;
            var effectId = Guid.NewGuid();
            var device   = new GenericDeviceImplementation(deviceId, _api.Object);

            _api.Setup(a => a.CreateDeviceEffectAsync(deviceId, EffectType.None, default(NoneEffect))).ReturnsAsync(effectId);

            var setEffectId = await device.SetEffectAsync(EffectType.None, default(NoneEffect));

            Assert.AreEqual(effectId, setEffectId);
        }
Ejemplo n.º 8
0
        public void ShouldThrowOnSetAll()
        {
            var device = new GenericDeviceImplementation(Devices.Blade14, _api.Object);

            Assert.ThrowsAsync <NotSupportedException>(() => device.SetAllAsync(Color.Red));
        }