CreateUnsavedValidCar() public static method

Creates a new unsaved Car with a random value assigned to every property
public static CreateUnsavedValidCar ( ) : Car
return Car
Esempio n. 1
0
        public void Test_Inheritance_CodeClass_InheritsCorrectly()
        {
            CheckIfTestShouldBeIgnored();
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            Car car = TestUtilsCar.CreateUnsavedValidCar();

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <Vehicle>(car);
        }
Esempio n. 2
0
        public void Test_ToString()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            Car car = TestUtilsCar.CreateUnsavedValidCar();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            string toStringValue = car.ToString();

            //---------------Test Result -----------------------
            Assert.Fail("Implement ToString() for Car and refine this test");
            //Assert.AreEqual(car.SomeProperty, toStringValue);
        }
Esempio n. 3
0
        [Test] // Ensures that a class can be successfully saved
        public void Test_SaveCar()
        {
            CheckIfTestShouldBeIgnored();
            //---------------Set up test pack-------------------
            Car car = TestUtilsCar.CreateUnsavedValidCar();

            //---------------Assert Precondition----------------
            Assert.IsTrue(car.Status.IsNew);
            BusinessObjectCollection <Car> col = new BusinessObjectCollection <Car>();

            col.LoadAll();
            Assert.AreEqual(0, col.Count);

            //---------------Execute Test ----------------------
            car.Save();

            //---------------Test Result -----------------------
            Assert.IsFalse(car.Status.IsNew);
            col.LoadAll();
            Assert.AreEqual(1, col.Count);
        }