public void PuzzleSet_AddRangeCheck_Test1() { var sut = new PuzzleSet(PuzzleSize.FourByFour); Assert.Throws <ArgumentOutOfRangeException>(() => sut.Add(0)); Assert.Throws <ArgumentOutOfRangeException>(() => sut.Add(5)); sut = new PuzzleSet(PuzzleSize.NineByNine); Assert.Throws <ArgumentOutOfRangeException>(() => sut.Add(0)); Assert.Throws <ArgumentOutOfRangeException>(() => sut.Add(10)); sut = new PuzzleSet(PuzzleSize.SixteenBySixteen); Assert.Throws <ArgumentOutOfRangeException>(() => sut.Add(0)); Assert.Throws <ArgumentOutOfRangeException>(() => sut.Add(17)); }
public void PuzzleSet_GetEnumerator_Test1() { var sut = new PuzzleSet(PuzzleSize.NineByNine); var list = new List <byte>(); for (byte i = 1; i < 6; i++) { sut.Add(i); list.Add(i); } Assert.Equal(sut, list); }
public void PuzzleSet_AddSyncsWithCount_Test2() { foreach (var size in new[] { PuzzleSize.FourByFour, PuzzleSize.NineByNine, PuzzleSize.SixteenBySixteen }) { var sut = new PuzzleSet(size); foreach (var value in Enumerable.Range(1, sut.MaxValue).Select(Convert.ToByte)) { Assert.True(sut.Add(value)); Assert.Equal(value, sut.Count); } foreach (var value in Enumerable.Range(1, sut.MaxValue).Select(Convert.ToByte)) { Assert.False(sut.Add(value)); Assert.Equal(sut.MaxValue, sut.Count); } } }
public void PuzzleSet_Contains_Test1() { foreach (var size in new[] { PuzzleSize.FourByFour, PuzzleSize.NineByNine, PuzzleSize.SixteenBySixteen }) { var sut = new PuzzleSet(size); foreach (var value in Enumerable.Range(1, sut.MaxValue).Select(Convert.ToByte)) { Assert.True(sut.Add(value)); Assert.Contains(value, sut); sut.Clear(); Assert.DoesNotContain(value, sut); } } }