public void TopColor() { var vial = new Vial(); vial.TopColor.ShouldBe(Color.None); vial.Stack(Color.Red); vial.TopColor.ShouldBe(Color.Red); vial.Stack(new Color[] { Color.Blue, Color.Green }); vial.TopColor.ShouldBe(Color.Green); vial = new Vial(new Color[] { Color.Blue, Color.Yellow }); vial.TopColor.ShouldBe(Color.Yellow); }
public VialSet Generate(int numberOfColors, int numberOfEmptyVials) { var vialColors = new List <Color>(); var vials = new List <Vial>(); foreach (var color in GeneratePalette(numberOfColors).Shuffle()) { vialColors.Add(color); if (vialColors.Count >= Vial.Length) { var vial = new Vial(); vial.Stack(vialColors); vials.Add(vial); vialColors = new List <Color>(); } } for (int i = 0; i < numberOfEmptyVials; i++) { vials.Add(new Vial()); } return(new VialSet() { Vials = vials }); }
public void StackingTooManyColorsThrowsException() { var vial = new Vial(new Color[] { Color.Blue, Color.Yellow, Color.Green, Color.Blue }); var exceptionThrown = false; try { vial.Stack(Color.Red); } catch { exceptionThrown = true; } exceptionThrown.ShouldBeTrue(); exceptionThrown = false; vial = new Vial(); try { vial.Stack(new Color[] { Color.Blue, Color.Yellow, Color.Green, Color.Blue, Color.Red }); } catch { exceptionThrown = true; } exceptionThrown.ShouldBeTrue(); }
public void IsCompleteMeansVialIsFull() { var vial = new Vial(new Color[] { Color.Blue, Color.Blue, Color.Blue }); vial.IsComplete.ShouldBeFalse(); vial.Stack(Color.Blue); vial.IsComplete.ShouldBeTrue(); }
public void IsFull() { var vial = new Vial(); vial.IsFull.ShouldBeFalse(); vial.Stack(Color.Red); vial.IsFull.ShouldBeFalse(); vial.Stack(Color.Green); vial.IsFull.ShouldBeFalse(); vial.Stack(Color.Red); vial.IsFull.ShouldBeFalse(); vial.Stack(Color.Yellow); vial.IsFull.ShouldBeTrue(); vial = new Vial(new Color[] { Color.Blue, Color.Green, Color.Blue, Color.Green }); vial.IsFull.ShouldBeTrue(); }
public void StackingNoneThrowsException() { var vial = new Vial(); var exceptionThrown = false; try { vial.Stack(new Color[] { Color.Blue, Color.Yellow, Color.None, Color.Blue }); } catch { exceptionThrown = true; } exceptionThrown.ShouldBeTrue(); }