本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}