Ejemplo n.º 1
0
        public void TestThatObjectMotherBMWWorks()
        {
            var result = ObjectMother.BMW();

            Assert.AreEqual(result.Name, "BMW 3 Series");
            Assert.AreEqual(result.getBasePrice(), 80);
        }
Ejemplo n.º 2
0
        public void TestThatObjectMotherSpawnedCarWorks()
        {
            Car    beamer     = ObjectMother.BMW();
            String nameResult = beamer.Name;

            Assert.AreEqual("Beamer", nameResult);
        }
Ejemplo n.º 3
0
        public void TestThatCarRentalPricesAreCorrectWithObjectMother()
        {
            Car BMW  = ObjectMother.BMW();
            Car Saab = ObjectMother.Saab();

            Assert.AreEqual(80, BMW.getBasePrice());
            Assert.AreEqual(10 * 7 * .8, Saab.getBasePrice());
        }
Ejemplo n.º 4
0
        public void TestObjectMotherWithDatabase()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();

            mockDatabase.Miles = 2000;
            var target = ObjectMother.BMW();

            target.Database = mockDatabase;
            int milesTravled = target.Mileage;

            Assert.AreEqual(2000, milesTravled);
        }
Ejemplo n.º 5
0
        public void TestMileage()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();
            Int32     Mil          = 100;

            mockDatabase.Miles = Mil;
            var target = ObjectMother.BMW();

            target.Database = mockDatabase;
            int miles = target.Mileage;

            Assert.AreEqual(miles, Mil);
        }
Ejemplo n.º 6
0
        public void TestThatCarDoesGetMileageFromDatabaseWithObjectMother()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();
            Int32     Miles        = 100;

            mockDatabase.Miles = Miles;
            var target = ObjectMother.BMW();

            target.Database = mockDatabase;
            int miles = target.Mileage;

            Assert.AreEqual(miles, Miles);
        }
Ejemplo n.º 7
0
        public void TestThatTheCarGetsTheCorrectCarNumberAndThatTheReturnedCarNumberIsPerfectlyCorrectWithoutADoubt()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(15);
                LastCall.Return("foo");
            }
            var target = ObjectMother.BMW();

            target.Database = mockDatabase;
            Assert.AreEqual("foo", target.getCarLocation(15));
        }
Ejemplo n.º 8
0
        public void TestThatTheCarCanCorrectlyTrackHowManyMilesItHasBeenDrivenSinceItWasCreatedInSomeRandomFactoryInDetroitOrChinaIfItIsAJapaneseCarBecauseDetroitIsPrettyMuchDead()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();

            mockDatabase.Miles = 100;

            var target = ObjectMother.BMW();

            target.Database = mockDatabase;

            int mileage = target.Mileage;

            Assert.AreEqual(mileage, 100);
        }
Ejemplo n.º 9
0
        public void TestThatObjectMother()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();
            int       mileage      = 100;

            mockDatabase.Miles = mileage;
            var target = ObjectMother.BMW();

            target.Database = mockDatabase;
            int    miles = target.Mileage;
            String name  = target.Name;

            Assert.AreEqual(miles, mileage);
            Assert.AreEqual("BMW Z4 Roadster", name);
        }
Ejemplo n.º 10
0
        public void TestThatCarDoesGetMileageFromDatabase()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();

            int Mileage = 100;

            mockDatabase.Miles = Mileage;
            var target = ObjectMother.BMW();

            target.Database = mockDatabase;

            int mileCount = target.Mileage;

            Assert.AreEqual(mileCount, Mileage);
        }
Ejemplo n.º 11
0
        public void TestThatMileageISCorrect()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();
            Int32     Miles        = 100;


            mockDatabase.Miles = Miles;

            var target = ObjectMother.BMW();

            target.Database = mockDatabase;

            int mileage = target.Mileage;

            Assert.AreEqual(mileage, Miles);
        }
Ejemplo n.º 12
0
        public void TestThatLocationGetsFromDatabase()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();

            String carLocation = "Earth";

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(23);
                LastCall.Return(carLocation);
            }

            var target = ObjectMother.BMW();

            target.Database = mockDatabase;
            String result;

            result = target.getCarLocation(23);
            Assert.AreEqual(result, carLocation);
        }
Ejemplo n.º 13
0
        public void TestThatTheCarGetsTheCorrectCarNumberAndThatTheReturnedCarNumberIsPerfectlyCorrectWithoutADoubt()
        {
            IDatabase mockDatabase = mocks.Stub <IDatabase>();

            String Loc10  = "On Sriram's Whale, Next To SQL.";
            String Loc150 = "In Sriram's Office";

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(10);
                LastCall.Return(Loc10);

                mockDatabase.getCarLocation(150);
                LastCall.Return(Loc150);
            }

            var target = ObjectMother.BMW();

            target.Database = mockDatabase;

            Assert.AreEqual(Loc10, target.getCarLocation(10));
            Assert.AreEqual(Loc150, target.getCarLocation(150));
        }
Ejemplo n.º 14
0
        public void TestObjectMother()
        {
            var target = ObjectMother.BMW();

            Assert.AreEqual("BMW", target.Name);
        }
Ejemplo n.º 15
0
        public void TestThatObjectMotherWorksProperly()
        {
            var target = ObjectMother.BMW();

            Assert.AreEqual("It's a BMW.", target.Name);
        }
Ejemplo n.º 16
0
        public void TestThatCarHasCorrectBasePriceForTenDays()
        {
            var target = ObjectMother.BMW();

            Assert.AreEqual(80, target.getBasePrice());
        }
Ejemplo n.º 17
0
        public void ObjectMotherTestCarName()
        {
            var target = ObjectMother.BMW();

            Assert.AreEqual(target.Name, "BMW Something");
        }
Ejemplo n.º 18
0
        public void TestThatCarHasCorrectBasePriceForTenDays_ObjectMotherStyle()
        {
            var target = ObjectMother.BMW(); //Car(21)

            Assert.AreEqual(168, target.getBasePrice());
        }
Ejemplo n.º 19
0
        public void TestThatBMWBookingIsCorrectlyPriced()
        {
            var target = ObjectMother.BMW();

            Assert.AreEqual(80, target.getBasePrice());
        }
Ejemplo n.º 20
0
        public void TestThatBMWHasCorrectRental()
        {
            Car bmw = ObjectMother.BMW();

            Assert.AreEqual(80, bmw.getBasePrice());
        }
Ejemplo n.º 21
0
        public void TestObjectMother()
        {
            var target = ObjectMother.BMW();

            Assert.AreEqual(target.Name, "BMW M5 Sports Car");
        }