public void AreAnyQueensHitEachOther_ZeroQueens() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = false; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ManyQueens_Hits_Horizontal() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(1, 1)); queens.Add(new ChessUnitData(1, 6)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = true; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_OneQueen_CornerRightUp() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(8, 8)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = false; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_QueenFallOffTheChessboard_ToDown() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(0, 5)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = false; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ValidInput() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(1, 3)); queens.Add(new ChessUnitData(1, 2)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = true; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ManyQueens_Hits_DiagonalDownLeftToRightUp() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(1, 1)); queens.Add(new ChessUnitData(8, 8)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = true; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ResultTrue() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(1, 7)); queens.Add(new ChessUnitData(2, 4)); queens.Add(new ChessUnitData(3, 2)); queens.Add(new ChessUnitData(4, 8)); queens.Add(new ChessUnitData(5, 6)); queens.Add(new ChessUnitData(6, 1)); queens.Add(new ChessUnitData(7, 3)); queens.Add(new ChessUnitData(8, 2)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = true; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ManyQueens_NoHits_MaxPossibleQueensNoHit() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(1, 7)); queens.Add(new ChessUnitData(2, 4)); queens.Add(new ChessUnitData(3, 2)); queens.Add(new ChessUnitData(4, 8)); queens.Add(new ChessUnitData(5, 6)); queens.Add(new ChessUnitData(6, 1)); queens.Add(new ChessUnitData(7, 3)); queens.Add(new ChessUnitData(8, 5)); //Act. bool actual = ChessQuestions.AreAnyQueensHitEachOther(queens); //Assert. bool expected = false; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ResultExceptionOffTheTable() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); //Act. string actual = ""; try { queens.Add(new ChessUnitData(1, 9)); ChessQuestions.AreAnyQueensHitEachOther(queens); } catch (Exception exception) { actual = exception.Message; } //Assert. string expected = "Фигура за границами доски"; Assert.AreEqual(expected, actual); }
public void AreAnyQueensHitEachOther_ResultExceptionQueenOnQueen() { //Arrange. List <ChessUnitData> queens = new List <ChessUnitData>(); queens.Add(new ChessUnitData(1, 3)); queens.Add(new ChessUnitData(1, 3)); //Act. string actual = ""; try { ChessQuestions.AreAnyQueensHitEachOther(queens); } catch (Exception exception) { actual = exception.Message; } //Assert. string expected = "Клетка занята - ферзь не может стоять здесь"; Assert.AreEqual(expected, actual); }