CreateUnsavedValidSteeringWheel() public static method

Creates a new unsaved SteeringWheel with a random value assigned to every property
public static CreateUnsavedValidSteeringWheel ( ) : SteeringWheel
return TestProject.BO.SteeringWheel
        public void Test_ToString()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            SteeringWheel steeringWheel = TestUtilsSteeringWheel.CreateUnsavedValidSteeringWheel();
            //---------------Assert Precondition----------------

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

            //---------------Test Result -----------------------
            Assert.Fail("Implement ToString() for SteeringWheel and refine this test");
            //Assert.AreEqual(steeringWheel.SomeProperty, toStringValue);
        }
Ejemplo n.º 2
0
        [Test]  // Ensures that a class can be successfully saved
        public void Test_SaveSteeringWheel()
        {
            CheckIfTestShouldBeIgnored();
            //---------------Set up test pack-------------------
            SteeringWheel steeringWheel = TestUtilsSteeringWheel.CreateUnsavedValidSteeringWheel();

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

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

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

            //---------------Test Result -----------------------
            Assert.IsFalse(steeringWheel.Status.IsNew);
            col.LoadAll();
            Assert.AreEqual(1, col.Count);
        }
Ejemplo n.º 3
0
        public void Test_NotSettingCompulsoryPropertiesThrowsException()
        {
            CheckIfTestShouldBeIgnored();
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            SteeringWheel steeringWheel = TestUtilsSteeringWheel.CreateUnsavedValidSteeringWheel();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            steeringWheel.SteeringWheelID = null;

            try
            {
                steeringWheel.Save();
                Assert.Fail("Should throw an exception when compulsory properties are null");
            }
            //---------------Test Result -----------------------
            catch (BusObjectInAnInvalidStateException ex)
            {
                StringAssert.Contains("Steering Wheel ID' is a compulsory field and has no value", ex.Message);
            }
        }