コード例 #1
0
        public void InsuranceTests_InsuranceCalculation1950_ShouldBeCorrect()
        {
            CarContentRepository insuranceRepo = new CarContentRepository();

            decimal actualValue = insuranceRepo.InsuranceCost(1950);
            decimal expected    = 2000m;

            Assert.AreEqual(expected, actualValue);
        }
コード例 #2
0
        public void InsuranceTests_AddCarToList_ShouldBeCorrect()
        {
            // next code is to add cars to the list "Car"
            // that we made in CarContent.cs
            // We are doing this by calling up our AddContentToList method
            // that we made in CarContentRepository.cs

            Car pinto    = new Car("Ford", "Pinto", 1986, "car", "rust", 3, true, 1);
            Car explorer = new Car("Ford", "Explorer", 1996, "SUV", "black", 4, false, 2);
            CarContentRepository repo = new CarContentRepository();

            repo.AddContentToList(pinto);
            repo.AddContentToList(explorer);

            int actual   = repo.GetContentFromList().Count;
            int expected = 2;

            Assert.AreEqual(expected, actual);
        }