コード例 #1
0
        public void ConstructorTest()
        {
            EngineSize es = new EngineSize(1.2, 4.6);

            Assert.AreEqual(1.2, es.Height);
            Assert.AreEqual(4.6, es.Width);
        }
コード例 #2
0
        public void CopyConstructorTest()
        {
            EngineSize es  = new EngineSize(1.2, 4.6);
            EngineSize es2 = new EngineSize(es);

            Assert.AreEqual(es.Height, es2.Height);
            Assert.AreEqual(es.Width, es2.Width);
        }
コード例 #3
0
        public void SetSelectedEngineSize_EnterCorrectData_SetEngineSize(string selectedEngineSize, double expectedSize)
        {
            EngineSize actualObjectEngineSize = new EngineSize(selectedEngineSize);

            objectEngineSize.engineSize = expectedSize;

            Assert.AreEqual(objectEngineSize.engineSize, actualObjectEngineSize.engineSize);
        }
コード例 #4
0
ファイル: Car.cs プロジェクト: tolco97/DNP2-Assignments
        public int CompareToByEngineSize(Car other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            return(other is null
                ? 1
                : EngineSize.CompareTo(other.EngineSize));
        }
コード例 #5
0
ファイル: Car.cs プロジェクト: saralopez7/DNP2Assignment1
        public (int, int, int, int, int) CompareCarProperties(Car other)
        {
            var comparisonTuple = (
                maxSpeedComparison : MaxSpeed.CompareTo(other.MaxSpeed),
                accelerationComparison : Acceleration.CompareTo(other.Acceleration),
                cylinderComparison : Cylinders.CompareTo(other.Cylinders),
                engineSizeComparison : EngineSize.CompareTo(other.EngineSize),
                horsePowerComparison : HorsePower.CompareTo(other.HorsePower)
                );

            return(comparisonTuple);
        }
コード例 #6
0
        public void Constructor2Test()
        {
            EnginePoint ep = new EnginePoint(1.5, 4.2);
            EngineSize  es = new EngineSize(5.0, 3.3);

            EngineRectangle er = new EngineRectangle(ep, es);

            Assert.AreEqual(ep.X, er.X);
            Assert.AreEqual(ep.Y, er.Y);
            Assert.AreEqual(es.Height, er.Height);
            Assert.AreEqual(es.Width, er.Width);
            Assert.AreEqual(Directions.Wrong, er.Direction);
            Assert.AreEqual(false, er.IsBarrier);
        }
コード例 #7
0
        public override void BuildEngine()
        {
            Console.WriteLine("Input engine size: 1 - 1.8, 2 - 2.0, 3 - 3.0");
            string selectedEngineSize = Console.ReadLine();

            EngineSize EngineSize = new EngineSize(selectedEngineSize);

            if (EngineSize.isEngineSizeTrue == true)
            {
                car.EngineSize = EngineSize.engineSize;
            }
            else
            {
                throw new NullReferenceException();
            }
        }
コード例 #8
0
        public void ChangeEngineSize(EngineSize engineSize)
        {
            switch (engineSize)
            {
            case EngineSize.Medium:
                PencePerMile    = 0.108f;
                this.engineSize = engineSize;
                break;

            case EngineSize.Large:
                PencePerMile    = 0.134f;
                this.engineSize = engineSize;
                break;

            default:
                PencePerMile    = 0.093f;
                this.engineSize = engineSize;
                break;
            }
        }
コード例 #9
0
 public Diesel(EngineSize engineSize = EngineSize.Small)
 {
     EngineType = "Diesel";
     ChangeEngineSize(engineSize);
 }
コード例 #10
0
 public EngineSize(EngineSize es)
 {
     this.Height = es.Height;
     this.Width  = es.Width;
 }
コード例 #11
0
ファイル: Petrol.cs プロジェクト: ocanica/csharp-learning
 public Petrol(EngineSize engineSize = EngineSize.Small)
 {
     EngineType = "Petrol";
     ChangeEngineSize(engineSize);
 }
コード例 #12
0
 public void SetEngine(EngineSize engineSize) =>
 engineSize.Equals(EngineSize.OnePointFive);
コード例 #13
0
 public void ChangeEngineSize(EngineSize engineSize)
 => _advisoryFuelRate.ChangeEngineSize(engineSize);
コード例 #14
0
ファイル: LPG.cs プロジェクト: ocanica/csharp-learning
 public LPG(EngineSize engineSize = EngineSize.Small)
 {
     EngineType = "LPG";
     ChangeEngineSize(engineSize);
 }
コード例 #15
0
 public void ChangeEngineSize(EngineSize engineSize)
 => Console.WriteLine("EMV has only 1 engine size");
コード例 #16
0
ファイル: Car.cs プロジェクト: pedr0206/BritishAutomobiles
 public void Print()
 {
     Console.WriteLine(Manufacture + " == " + Model + " " + EngineSize.ToString() + " " + FuelType + " >> " + ValveTrainConfig + "\n ");
 }