public void AddToEntry()
        {
            // Arrange
            var vehicle = new Vehicle
            {
                Name        = "Another Test",
                Price       = 50000,
                VehicleType = VehicleType.Probe
            };

            var entry = new VehicleEntry();

            entry.AddToEntry(vehicle);

            var expectedName  = "Another Test";
            var expectedPrice = 50000;
            var expectedType  = VehicleType.Probe;

            // Act
            var actualName  = vehicle.Name;
            var actualPrice = vehicle.Price;
            var actualType  = vehicle.VehicleType;

            // Assert
            Assert.AreEqual(expectedName, actualName);
            Assert.AreEqual(expectedPrice, actualPrice);
            Assert.AreEqual(expectedType, actualType);
        }
        public void ConstructorTwo()
        {
            // Arrange
            var vehicle = new Vehicle
            {
                Name        = "Test Vehicle",
                Price       = 143500,
                VehicleType = VehicleType.LaunchVehicle
            };

            var entry = new VehicleEntry(vehicle);

            var expectedName  = "Test Vehicle";
            var expectedPrice = 143500;
            var expectedType  = VehicleType.LaunchVehicle;

            // Act
            var actualName  = vehicle.Name;
            var actualPrice = vehicle.Price;
            var actualType  = vehicle.VehicleType;

            // Assert
            Assert.AreEqual(expectedName, actualName);
            Assert.AreEqual(expectedPrice, actualPrice);
            Assert.AreEqual(expectedType, actualType);
        }
        public void InvalidPrice()
        {
            // Arrange
            var vehicle = new Vehicle
            {
                Name        = "PriceTest",
                Price       = -20,
                VehicleType = VehicleType.Satellite
            };

            var entry    = new VehicleEntry(vehicle);
            var expected = 0;

            // Act
            var actual = entry.Price;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public VehicleInfo(RichTextBox rtbMain, TabControl tabControl, VehicleEntry vehicle)
        {
            _rtb        = rtbMain;
            _vehicle    = vehicle;
            _tabControl = tabControl;

            for (uint i = 0; i < (uint)Constants.MaxVehicleSeats; ++i)
            {
                var m = _vehicle.SeatId[i];
                if (m == 0)
                {
                    continue;
                }

                Contract.Assume(DBC.VehicleSeat.ContainsKey(m));

                _tabControl.TabPages.Add("seat" + i);
                var seatInfo = new VehicleSeatInfo(_rtb, DBC.VehicleSeat[m]);
                Seats.Add(seatInfo);
            }

            ViewVehicleInfo();
        }
Esempio n. 5
0
 private void onSectinoEntry(string vh_id)
 {
     VehicleEntry?.Invoke(this, vh_id);
 }
Esempio n. 6
0
 public static uint GetUsedCount(VehicleEntry vehicle)
 {
     return(SQL.CreatureTemplate.Count(x => x.Value.VehicleId == vehicle.Id).ToUInt32());
 }
Esempio n. 7
0
 private void onEntry(AVEHICLE vh)
 {
     VehicleEntry?.Invoke(this, vh);
 }