当前位置: 首页>>代码示例>>C#>>正文


C# Car.getCarLocation方法代码示例

本文整理汇总了C#中Expedia.Car.getCarLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Car.getCarLocation方法的具体用法?C# Car.getCarLocation怎么用?C# Car.getCarLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Expedia.Car的用法示例。


在下文中一共展示了Car.getCarLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestThatCarDoesGetCarLocationFromTheDatabase

        public void TestThatCarDoesGetCarLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();
            int car1 = 10;
            String car1Location = "Hawaii";

            int car2 = 50;
            String car2Location = "Indiana";

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(car1);
                LastCall.Return(car1Location);

                mockDatabase.getCarLocation(car2);
                LastCall.Return(car2Location);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result;
            result = target.getCarLocation(10);
            Assert.AreEqual(result, car1Location);

            result = target.getCarLocation(50);
            Assert.AreEqual(result, car2Location);
        }
开发者ID:HawaiianNinja,项目名称:Lab4-hopkinaj,代码行数:28,代码来源:CarTest.cs

示例2: TestThatCarDoesGetLocationFromTheDatabase

        public void TestThatCarDoesGetLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();
            String carLocation = "My Garage";
            String anotherCarLocation = "Stelvio Pass";

            using (mocks.Record())
            {
                // The mock will return "My Garage" when the call is made with 15
                mockDatabase.getCarLocation(15);
                LastCall.Return(carLocation);

                // The mock will return "Stelvio Pass" when the call is made with 23
                mockDatabase.getCarLocation(23);
                LastCall.Return(anotherCarLocation);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(15);
            Assert.AreEqual(result, carLocation);

            result = target.getCarLocation(23);
            Assert.AreEqual(result, anotherCarLocation);
        }
开发者ID:pohltm,项目名称:Lab4-pohltm,代码行数:28,代码来源:CarTest.cs

示例3: TestThatCarDoesGetCarLocationFromDatabase

        public void TestThatCarDoesGetCarLocationFromDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String location1 = "Lot A";
            String location2 = "Lot C";

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(5);
                LastCall.Return(location1);

                mockDatabase.getCarLocation(10);
                LastCall.Return(location2);
            }

            var target = new Car(5);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(5);
            Assert.AreEqual(result, location1);

            result = target.getCarLocation(10);
            Assert.AreEqual(result, location2);
        }
开发者ID:westeras,项目名称:Lab4-westeras,代码行数:27,代码来源:CarTest.cs

示例4: TestGetCorrectCarLocationFromDatabase

        public void TestGetCorrectCarLocationFromDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String location1 = "Terre Haute, Indiana";
            String location2 = "Morristown, Indiana";

            using (mocks.Record())
            {
                // The mock will return "Terre Haute, Indiana" when the call is made with 1
                mockDatabase.getCarLocation(1);
                LastCall.Return(location1);
                // The mock will return "Morristown, Indiana" when the call is made with 2
                mockDatabase.getCarLocation(2);
                LastCall.Return(location2);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result;
            result = target.getCarLocation(1);
            Assert.AreEqual(result, location1);
            result = target.getCarLocation(2);
            Assert.AreEqual(result, location2);
        }
开发者ID:sheltotj,项目名称:Lab4-sheltotj,代码行数:26,代码来源:CarTest.cs

示例5: TestThatCarGetsLocationFromDatabase

        public void TestThatCarGetsLocationFromDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String firstLocation = "Terre Haute";
            String otherLocation = "Spaaaaace!";

            using(mocks.Record())
            {
                mockDatabase.getCarLocation(15);
                LastCall.Return(firstLocation);

                mockDatabase.getCarLocation(311);
                LastCall.Return(otherLocation);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(311);
            Assert.AreEqual(result, otherLocation);

            result = target.getCarLocation(15);
            Assert.AreEqual(result, firstLocation);
        }
开发者ID:SoggyNoose,项目名称:Lab4-kimsj,代码行数:27,代码来源:CarTest.cs

示例6: TestThatCarCanGetCarLocationFromTheDatabase

        public void TestThatCarCanGetCarLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String carLocation1337 = "Home";
            String carLocation1024 = "Mars";

            using(mocks.Record())
            {
                // The mock will return "Mars" when the call is made with 1024
                mockDatabase.getCarLocation(1024);
                LastCall.Return(carLocation1024);

                // The mock will return "Home" when the call is made with 1337
                mockDatabase.getCarLocation(1337);
                LastCall.Return(carLocation1337);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(1337);
            Assert.AreEqual(result, carLocation1337);

            result = target.getCarLocation(1024);
            Assert.AreEqual(result, carLocation1024);
        }
开发者ID:punpun1000,项目名称:Lab4-mercermt,代码行数:29,代码来源:CarTest.cs

示例7: TestThatCarDoesGetLocationFromTheDatabase

        public void TestThatCarDoesGetLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();
            String carLocation = "On a whale";
            String anotherCarLocation = "On a raptor ranch";

            using (mocks.Record())
            {
                // The mock will return "On a whale" when the call is made with 24
                mockDatabase.getCarLocation(24);
                LastCall.Return(carLocation);
                // The mock will return "Raptor Wrangler" when the call is made with 1025
                mockDatabase.getCarLocation(1025);
                LastCall.Return(anotherCarLocation);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(1025);
            Assert.AreEqual(result, anotherCarLocation);

            result = target.getCarLocation(24);
            Assert.AreEqual(result, carLocation);
        }
开发者ID:veatchje,项目名称:Lab4-veatchje,代码行数:27,代码来源:CarTest.cs

示例8: TestThatCarDoesGetCarLocationFromTheDatabase

        public void TestThatCarDoesGetCarLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();
            int carNumber1 = 34;
            int carNumber2 = 55;
            String carLocation1 = "1397B";
            String carLocation2 = "1678D";
            int daysToRent = 10;

            using(mocks.Record())
            {
              mockDatabase.getCarLocation(carNumber1);
              LastCall.Return(carLocation1);

              mockDatabase.getCarLocation(carNumber2);
              LastCall.Return(carLocation2);
            }

            var target = new Car(daysToRent);
            target.Database = mockDatabase;

            String result;
            result = target.getCarLocation(carNumber2);
            Assert.AreEqual(carLocation2, result);

            result = target.getCarLocation(carNumber1);
            Assert.AreEqual(carLocation1,result);
        }
开发者ID:zhengc,项目名称:Lab4-zhengc,代码行数:28,代码来源:CarTest.cs

示例9: TestCarLocation

        public void TestCarLocation()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String car1 = "Here";
            String car2 = "There";
            using (mocks.Record())
            {
                mockDatabase.getCarLocation(5);
                LastCall.Return(car1);

                mockDatabase.getCarLocation(8);
                LastCall.Return(car2);
            }

            var target = new Car(5);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(5);
            Assert.AreEqual(result, car1);

            result = target.getCarLocation(8);
            Assert.AreEqual(result, car2);
        }
开发者ID:banksda,项目名称:Lab4-banksda,代码行数:26,代码来源:CarTest.cs

示例10: TestThatCarDoesGetLocationFromTheDatabase

        public void TestThatCarDoesGetLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();
            String carLocation = "Parking lot A53, row 6, next to the rabid squirrels' nest";
            String anotherCarLocation = "Forever lost";
            using (mocks.Record())
            {
                // The mock will return "Whale Rider" when the call is made with 24
                mockDatabase.getCarLocation(24);
                LastCall.Return(carLocation);
                // The mock will return "Raptor Wrangler" when the call is made with 1025
                mockDatabase.getCarLocation(1025);
                LastCall.Return(anotherCarLocation);
            }
            var target = new Car(10);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(1025);
            Assert.AreEqual(result, anotherCarLocation);

            result = target.getCarLocation(24);
            Assert.AreEqual(result, carLocation);
        }
开发者ID:KimberlyBoucher,项目名称:Lab2-boucheka,代码行数:25,代码来源:CarTest.cs

示例11: TestThatCarDoesGetCarLocationFromTheDatabase

        public void TestThatCarDoesGetCarLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String carLocation = "there";
            String anotherCarLocation = "everywhere";

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(17);
                LastCall.Return(carLocation);
                mockDatabase.getCarLocation(5);
                LastCall.Return(anotherCarLocation);
            }
            var target = new Car(10);
            target.Database = mockDatabase;

            String result;

            result = target.getCarLocation(5);
            Assert.AreEqual(result, anotherCarLocation);

            result = target.getCarLocation(17);
            Assert.AreEqual(result, carLocation);
        }
开发者ID:floytesangen,项目名称:Lab4-lapresga,代码行数:25,代码来源:CarTest.cs

示例12: TestThatCarDoesGetMileageFromTheDatabase

        public void TestThatCarDoesGetMileageFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();
            String ZeroMileage = "Zero mileage, you're going nowhere";
            String NegativeMileage = "Neagive mileage, you're going backwards";
            String PositiveMileage = "Positive Mileage, you're doing it right";

            using (mocks.Record())
            {

                mockDatabase.getCarLocation(0);
                LastCall.Return(ZeroMileage);

                mockDatabase.getCarLocation(-45);
                LastCall.Return(NegativeMileage);

                mockDatabase.getCarLocation(80);
                LastCall.Return(PositiveMileage);
            }

            var target = new Car(10);

            target.Database = mockDatabase;

            String result;
            result = target.getCarLocation(0);
            Assert.AreEqual(result, ZeroMileage);
            result = target.getCarLocation(-45);
            Assert.AreEqual(result, NegativeMileage);
            result = target.getCarLocation(80);
            Assert.AreEqual(result, PositiveMileage);
        }
开发者ID:galvezdm,项目名称:Lab4-galvezdm,代码行数:32,代码来源:CarTest.cs

示例13: TestThatCarDoesGetLocationFromTheDatabase

        public void TestThatCarDoesGetLocationFromTheDatabase()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            String car = "Beetle";
            String truck = "Wat";

            using (mocks.Record())
            {
                mockDatabase.getCarLocation(1);
                LastCall.Return(car);

                mockDatabase.getCarLocation(2);
                LastCall.Return(truck);
            }

            var target = new Car(10);
            target.Database = mockDatabase;

            String result = target.getCarLocation(1);
            Assert.AreEqual(result, car);

            result = target.getCarLocation(2);
            Assert.AreEqual(result, truck);
        }
开发者ID:ycdfn,项目名称:Lab4-michaeaj,代码行数:25,代码来源:CarTest.cs

示例14: TestgetCarLocation

 public void TestgetCarLocation()
 {
     IDatabase mockDatabase = mocks.Stub<IDatabase>();
     var target = new Car(3);
     target.Database = mockDatabase;
     String carLocation = target.getCarLocation(15);
     Assert.AreEqual(carLocation, mockDatabase.getCarLocation(15));
 }
开发者ID:spurrme,项目名称:Lab4-spurrme,代码行数:8,代码来源:CarTest.cs

示例15: TestThatCarCanGetLocation

        public void TestThatCarCanGetLocation()
        {
            IDatabase mockDatabase = mocks.Stub<IDatabase>();

            var target = new Car(10);
            target.Database = mockDatabase;
            String carLoc = target.getCarLocation(1);
            Assert.AreEqual(carLoc, mockDatabase.getCarLocation(1));
        }
开发者ID:Feroxmrbrick,项目名称:Lab4-frankmp,代码行数:9,代码来源:CarTest.cs


注:本文中的Expedia.Car.getCarLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。