Пример #1
0
        public void TestEquals_CompareDifferentTypesOfObjects()
        {
            Bow bow = new Bow(10, 20);
            int row = 10;

            Assert.IsFalse(bow.Equals(row));
        }
Пример #2
0
        public void TestConstructor_CreateBowWithValidParameters()
        {
            Bow bow = new Bow(10, 20);

            Assert.AreEqual(10, bow.Row);
            Assert.AreEqual(20, bow.Col);
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ship"/> class.
 /// </summary>
 /// <param name="bow">The ship's bow.</param>
 /// <param name="type">The ship type.</param>
 /// <param name="direction">The ship direction.</param>
 public Ship(Bow bow, ShipType type, ShipDirection direction)
 {
     this.Bow = bow;
     this.Type = type;
     this.IsSunk = false;
     this.Direction = direction;
     this.Size = this.GetSize(type);
 }
Пример #4
0
        public void TestInequalityOperator_ShouldCompareOnlyTheValuesOfRowAndCol()
        {
            Bow bow1 = new Bow(10, 20);
            Bow bow2 = new Bow(10, 20);
            Bow bow3 = new Bow(7, 9);

            Assert.IsFalse(bow1 != bow2);
            Assert.IsTrue(bow1 != bow3);
        }
Пример #5
0
        public void TestEquals_ShouldCompareOnlyTheValuesOfRowAndCol()
        {
            Bow bow1 = new Bow(10, 20);
            Bow bow2 = new Bow(10, 20);
            Bow bow3 = new Bow(7, 9);

            Assert.IsTrue(bow1.Equals(bow2));
            Assert.IsFalse(bow1.Equals(bow3));
        }
Пример #6
0
        public void TestGetHashCode_ShouldReturnRowAndColXORed()
        {
            Bow bow = new Bow(10, 20);

            Assert.AreEqual(30, bow.GetHashCode());
        }