[Test] // Ensures that the defaults have not been tampered public void Test_CreateSteeringWheelWithDefaults() { CheckIfTestShouldBeIgnored(); //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- SteeringWheel steeringWheel = new SteeringWheel(); //---------------Test Result ----------------------- }
[Test] // Checks that BOs in a single relationship load correctly (no tampering with class defs) public void Test_LoadThroughSingleRelationship_SteeringWheel() { CheckIfTestShouldBeIgnored(); //---------------Set up test pack------------------- BORegistry.DataAccessor = new DataAccessorInMemory(); SteeringWheel wheel = TestUtilsSteeringWheel.CreateSavedSteeringWheel(); Car car = wheel.Car; TestProjectNoDBSpecificProps.BO.SteeringWheel boForRelationshipSteeringWheel = car.SteeringWheel; BusinessObjectManager.Instance.ClearLoadedObjects(); GC.Collect(); TestUtilsShared.WaitForGC(); //---------------Execute Test ---------------------- TestProjectNoDBSpecificProps.BO.SteeringWheel loadedRelatedBO = Broker.GetBusinessObject <TestProjectNoDBSpecificProps.BO.SteeringWheel>(boForRelationshipSteeringWheel.ID); Car loadedCar = Broker.GetBusinessObject <Car>(car.ID); //---------------Test Result ----------------------- Assert.AreEqual(boForRelationshipSteeringWheel, loadedCar.SteeringWheel); Assert.AreEqual(loadedRelatedBO, loadedCar.SteeringWheel); Assert.AreEqual(loadedRelatedBO, car.SteeringWheel); }
[Test] // Ensures that property setters in the code point to the correct property public void Test_PropertySettersUseCorrectPropertyNames() { CheckIfTestShouldBeIgnored(); //---------------Set up test pack------------------- SteeringWheel steeringWheel = new SteeringWheel(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- Car valueForCar = TestUtilsCar.CreateSavedCar(); steeringWheel.SetPropertyValue("CarID", (object)valueForCar.ID.GetAsGuid()); //---------------Test Result ----------------------- Assert.AreEqual(valueForCar, steeringWheel.Car); }
[Test] // Ensures that gets and sets in the code refer to the same property public void Test_PropertyGetters() { CheckIfTestShouldBeIgnored(); //---------------Set up test pack------------------- SteeringWheel steeringWheel = new SteeringWheel(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- //---------------Test Result ----------------------- }
/// <summary> /// Creates a new unsaved SteeringWheel where all properties are null, except ID properties /// and those with default values. If there are compulsory properties without /// defaults, saving the object will throw an exception. /// </summary> public static SteeringWheel CreateUnsavedDefaultSteeringWheel() { SteeringWheel steeringWheel = new SteeringWheel(); return steeringWheel; }
/// <summary> /// Creates a new unsaved SteeringWheel with a random value assigned to every property /// </summary> public static SteeringWheel CreateUnsavedValidSteeringWheel() { SteeringWheel steeringWheel = new SteeringWheel(); steeringWheel.Car = TestUtilsCar.CreateSavedCar(); return steeringWheel; }