Esempio n. 1
0
        public void ClonedStructShouldBeIdentical()
        {
            var original = new Custom(Color.Red);
            var clone = original.Clone();

            Assert.That(clone, Is.EqualTo(original));
        }
Esempio n. 2
0
        public void ClonedStructShouldBeIndependent()
        {
            var original = new Custom(Color.Red);
            var clone = original.Clone();

            clone.Set(Color.Blue);

            Assert.That(clone, Is.Not.EqualTo(original));
        }
Esempio n. 3
0
        public void ShouldEqualIdenticalEffect()
        {
            var a = new Custom(Color.Red);
            var b = new Custom(Color.Red);

            Assert.True(a == b);
            Assert.False(a != b);
            Assert.True(a.Equals(b));
            Assert.AreEqual(a, b);
        }
Esempio n. 4
0
        public void ShouldEqualIdenticalArray()
        {
            var effect = new Custom(Color.Red);
            var array = new Color[Constants.MaxLeds];

            for (var i = 0; i < Constants.MaxLeds; i++)
                array[i] = Color.Red;

            Assert.True(effect == array);
            Assert.False(effect != array);
            Assert.True(effect.Equals(array));
            Assert.AreEqual(effect, array);
        }
Esempio n. 5
0
 public void Set(Custom effect)
 {
     SetGuid(NativeWrapper.CreateMousepadEffect(effect));
 }
Esempio n. 6
0
 /// <summary>
 /// Prevents a default instance of the <see cref="Mousepad" /> class from being created.
 /// </summary>
 private Mousepad()
 {
     Log.Debug("Mousepad is initializing.");
     Chroma.InitInstance();
     _custom = Custom.Create();
 }
Esempio n. 7
0
        public void ShouldGetCorrectColor()
        {
            var colors = new Color[Constants.MaxLeds];
            colors[5] = Color.Red;

            var effect = new Custom(colors);

            Assert.That(effect[5], Is.EqualTo(colors[5]));
        }
Esempio n. 8
0
        public void ShouldThrowOnInvalidListCount()
        {
            var colors = new Color[1];

            // ReSharper disable once NotAccessedVariable
            Custom dummy;

            Assert.That(
                () => dummy = new Custom(colors),
                Throws.InstanceOf<ArgumentException>().With.Property("ParamName").EqualTo("colors"));
        }
Esempio n. 9
0
        public void ShouldSetCorrectColorsFromList()
        {
            var colors = new Color[Constants.MaxLeds];
            colors[0] = Color.Red;
            colors[1] = Color.Blue;
            colors[2] = Color.Green;

            var effect = new Custom(colors);

            for (var i = 0; i < Constants.MaxLeds; i++)
                Assert.That(effect[i], Is.EqualTo(colors[i]));
        }
Esempio n. 10
0
        public void ShouldSetAllColorsWithColorConstructor()
        {
            var effect = new Custom(Color.Red);

            for (var i = 0; i < Constants.MaxLeds; i++)
                Assert.That(effect[i], Is.EqualTo(Color.Red));
        }
Esempio n. 11
0
        public void ShouldNotEqualDifferentEffect()
        {
            var a = new Custom(Color.Red);
            var b = new Custom(Color.Blue);

            Assert.False(a == b);
            Assert.True(a != b);
            Assert.False(a.Equals(b));
            Assert.AreNotEqual(a, b);
        }
Esempio n. 12
0
        public void ShouldNotEqualArrayWithInvalidLength()
        {
            var effect = new Custom(Color.Red);
            var array = new[] { Color.Red, Color.Red, Color.Red };

            Assert.False(effect == array);
            Assert.True(effect != array);
            Assert.False(effect.Equals(array));
            Assert.AreNotEqual(effect, array);
        }