示例#1
0
        public void AddOverFuelTest()
        {
            // Arrange
            B52 b52 = new B52();

            //Act
            // Assert
            Assert.ThrowsException <FuelErrorException>(() => b52.AddFuel(300001));
        }
示例#2
0
        public void TakeOffLimitTest()
        {
            // Arrange
            B52 b52 = new B52();

            b52.Weight = 200000;
            // Act
            // Assert
            Assert.ThrowsException <WeightErrorException>(() => b52.AddFuel(300000));
        }
示例#3
0
        public void OverWeightWCMDTest()
        {
            B52    b52        = new B52();
            Weapon WCMDWeapon = new Weapon(WeaponType.WCMD);

            b52.Weight = 485000;

            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Left, WCMDWeapon));
            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Right, WCMDWeapon));
        }
示例#4
0
        public void OverWeightGravityTest()
        {
            B52    b52           = new B52();
            Weapon GravityWeapon = new Weapon(WeaponType.Gravity);

            b52.Weight = 485000;

            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Left, GravityWeapon));
            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Right, GravityWeapon));
            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Bay, GravityWeapon));
        }
示例#5
0
        public void OverWeightALCMTest()
        {
            B52    b52        = new B52();
            Weapon ALCMWeapon = new Weapon(WeaponType.ALCM);

            b52.Weight = 485000;

            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Left, ALCMWeapon));
            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Right, ALCMWeapon));
            Assert.ThrowsException <WeightErrorException>(() => b52.AddWeapon(Storage.Bay, ALCMWeapon));
        }
示例#6
0
        public void ClearFuelTest()
        {
            // Arrange
            B52 b52 = new B52();

            int expected = 0;
            // Act
            int actual = b52.Fuel;

            // Assert
            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void ClearWeaponTest()
        {
            // Arrange
            B52 b52 = new B52();

            int expected = 185000;
            // Act
            int actual = b52.Weight;

            // Assert
            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void AddFuelTest()
        {
            // Arrange
            B52 b52      = new B52();
            int expected = 100000;

            // Act
            b52.AddFuel(100000);

            // Assert
            Assert.AreEqual(expected, b52.Fuel);
        }
示例#9
0
        public void CalcWeightTest()
        {
            // Arrange
            B52 b52 = new B52();

            b52.Fuel   = 100000;
            b52.Weight = 200000;
            int expected = 300000;
            // Act
            int actual = b52.CalcWeight();

            // Assert
            Assert.AreEqual(expected, actual);
        }
示例#10
0
        public void IsReadyForTakeOffTest()
        {
            // Arrange
            B52  b52      = new B52();
            bool expected = false;
            // Act
            bool actual = b52.IsReadyForTakeOff();

            // Assert
            Assert.AreEqual(expected, actual);

            b52.Fuel = 100000;
            expected = true;
            actual   = b52.IsReadyForTakeOff();
            Assert.AreEqual(expected, actual);
        }
示例#11
0
        public void AddWCMDWeaponTest()
        {
            // Arrange
            B52    b52        = new B52();
            Weapon WCMDWeapon = new Weapon(WeaponType.WCMD);
            int    expected   = 217648;

            // Act
            b52.AddWeapon(Storage.Left, WCMDWeapon);
            b52.AddWeapon(Storage.Right, WCMDWeapon);
            int actual = b52.CalcWeight();

            // Assert
            Assert.AreEqual(expected, actual);
            Assert.ThrowsException <LoadErrorException>(() => b52.AddWeapon(Storage.Left, WCMDWeapon));
            Assert.ThrowsException <LoadErrorException>(() => b52.AddWeapon(Storage.Right, WCMDWeapon));
            Assert.ThrowsException <LoadErrorException>(() => b52.AddWeapon(Storage.Bay, WCMDWeapon));
        }
示例#12
0
        public void B52Test()
        {
            // Arrange
            B52 b52 = new B52();
            int expectInitWeight = 185000;
            int expectFuel       = 0;

            // Act
            int actualWeight = b52.Weight;
            int actualFuel   = b52.Fuel;

            // Assert
            Assert.AreEqual(expectInitWeight, actualWeight);
            Assert.AreEqual(expectFuel, actualFuel);
            Assert.IsNotNull(b52.LeftWing);
            Assert.IsNotNull(b52.RightWing);
            Assert.IsNotNull(b52.Bay);
        }