public void ShouldSetWithIndexIndexer() { var grid = DeathstalkerGridEffect.Create(); grid[2] = Color.Red; Assert.AreEqual(Color.Red, grid[2]); }
public void ShouldClearToBlack() { var grid = new DeathstalkerGridEffect(Color.Pink); grid.Clear(); Assert.That(grid, Is.EqualTo(DeathstalkerGridEffect.Create())); }
public void ShouldNotEqualNull() { var grid = DeathstalkerGridEffect.Create(); Assert.False(grid == null); Assert.True(grid != null); Assert.AreNotEqual(grid, null); }
public void ShouldSetNewColors() { var grid = DeathstalkerGridEffect.Create(); grid[1] = Color.Red; Assert.That(grid[1], Is.EqualTo(Color.Red)); }
public void ClonedStructShouldBeIndependent() { var original = new DeathstalkerGridEffect(Color.Red); var clone = original.Clone(); clone.Set(Color.Blue); Assert.That(clone, Is.Not.EqualTo(original)); }
public void ShouldSetAllColorsWithColorCtor() { var grid = new DeathstalkerGridEffect(Color.Red); for (var index = 0; index < KeyboardConstants.MaxDeathstalkerZones; index++) { Assert.That(grid[index], Is.EqualTo(Color.Red)); } }
public void ShouldSetToBlackWithCreate() { var grid = DeathstalkerGridEffect.Create(); for (var index = 0; index < KeyboardConstants.MaxDeathstalkerZones; index++) { Assert.That(grid[index], Is.EqualTo(Color.Black)); } }
public void ShouldNotEqualArbitraryObject() { var grid = DeathstalkerGridEffect.Create(); var obj = new object(); Assert.False(grid == obj); Assert.True(grid != obj); Assert.False(grid.Equals(obj)); Assert.AreNotEqual(grid, obj); }
public void ShouldNotEqualDifferentGrid() { var a = new DeathstalkerGridEffect(Color.Red); var b = new DeathstalkerGridEffect(Color.Pink); Assert.False(a == b); Assert.True(a != b); Assert.False(a.Equals(b)); Assert.AreNotEqual(a, b); }
public void ShouldEqualIdenticalGrid() { var a = new DeathstalkerGridEffect(Color.Red); var b = new DeathstalkerGridEffect(Color.Red); Assert.True(a == b); Assert.False(a != b); Assert.True(a.Equals(b)); Assert.AreEqual(a, b); }
public void ClonedStructShouldBeIdentical() { var original = new DeathstalkerGridEffect(Color.Red) { [1] = Color.Green, [3] = Color.Orange, [4] = Color.Orange }; var clone = original.Clone(); Assert.That(clone, Is.EqualTo(original)); }
public void ShouldConstructProperMultiArray() { var effect = DeathstalkerGridEffect.Create(); effect[0] = Color.Red; effect[1] = Color.Green; effect[5] = Color.Blue; var multiArray = effect.ToMultiArray(); Assert.AreEqual(Color.Red, multiArray[1, 1]); Assert.AreEqual(Color.Green, multiArray[1, 4]); Assert.AreEqual(Color.Blue, multiArray[1, 18]); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="KeyboardImplementation" /> class. /// </summary> public KeyboardImplementation(IChromaApi api) : base(api) { Log.Info("Keyboard initializing..."); CurrentEffectId = Guid.Empty; // We keep a local copy of a grid to speed up grid operations Log.Debug("Initializing private copy of Custom"); _grid = CustomKeyboardEffect.Create(); Log.Debug("Initializing private copy of Deathstalker grid"); _deathstalkerGrid = DeathstalkerGridEffect.Create(); }
public void ShouldThrowWhenOutOfRange1DSet() { var grid = DeathstalkerGridEffect.Create(); Assert.That( () => grid[-1] = Color.Red, Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("index") .And.Property("ActualValue") .EqualTo(-1)); Assert.That( () => grid[KeyboardConstants.MaxDeathstalkerZones] = Color.Red, Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("index") .And.Property("ActualValue") .EqualTo(KeyboardConstants.MaxDeathstalkerZones)); }
public void ShouldThrowWhenOutOfRange1DGet() { var grid = DeathstalkerGridEffect.Create(); // ReSharper disable once NotAccessedVariable Color dummy; Assert.That( () => dummy = grid[-1], Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("index") .And.Property("ActualValue") .EqualTo(-1)); Assert.That( () => dummy = grid[KeyboardConstants.MaxDeathstalkerZones], Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("index") .And.Property("ActualValue") .EqualTo(KeyboardConstants.MaxDeathstalkerZones)); }
public void ShouldGetWithIndexIndexer() { var grid = new DeathstalkerGridEffect(Color.Red); Assert.AreEqual(Color.Red, grid[3]); }
public void ShouldHaveZeroHashCodeOnDefaultInstance() { var effect = new DeathstalkerGridEffect(); Assert.Zero(effect.GetHashCode()); }