本文整理汇总了C#中Expedia.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于Expedia命名空间,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestThatUserHasFrequentFlierMilesAfterBooking2
public void TestThatUserHasFrequentFlierMilesAfterBooking2()
{
var target = new User("Bob Dole");
target.book(new Flight(StartDate, EndDate, 1), new Hotel(5), new Car(3));
Assert.Less(0, target.FrequentFlierMiles);
Assert.AreEqual(3, target.Bookings.Count);
}
示例2: TestThatHotelNotEqualToNonHotel
public void TestThatHotelNotEqualToNonHotel()
{
var hot1 = new Hotel(4);
var notHotel = new User("I'm not a hotel");
Assert.False(hot1.Equals(notHotel));
}
示例3: TestThatUserDoesRemoveCarFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveCarFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var carToBook = new Car(5);
var remainingCar = new Car(7);
serviceLocator.AddCar(carToBook);
serviceLocator.AddCar(remainingCar);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(carToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableCars.Count);
Assert.AreSame(remainingCar, ServiceLocator.Instance.AvailableCars[0]);
}
示例4: TestThatUserDoesRemovveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemovveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = new Flight(new DateTime(2009, 11, 1), new DateTime(2009, 11, 30), 750);
var remainingFlight = new Flight(new DateTime(2009, 11, 2), new DateTime(2009, 11, 28), 500);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例5: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = new Flight(DateTime.Now, DateTime.Now.AddDays(5), 0);
var otherFlight = new Flight(DateTime.Now, DateTime.Now.AddDays(10), 0);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(otherFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic)
.SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(otherFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例6: TestThatFlightIsRemovedFromServiceLocator
public void TestThatFlightIsRemovedFromServiceLocator()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = ObjectMother.FlightToChicago();
var remainingFlight = ObjectMother.FlightToChicago();
serviceLocator = new ServiceLocator();
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic)
.SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例7: TestThatUserDoesRemoveFlightFromSerivceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromSerivceLocatorWhenBooked()
{
ServiceLocator serviceloc = new ServiceLocator();
var flightToBook = new Flight(new DateTime(2009, 11, 1), new DateTime(2009, 11, 30), 100);
var remainingFlight = new Flight(new DateTime(2009, 12, 1), new DateTime(2009, 12, 30), 1000);
serviceloc.AddFlight(flightToBook);
serviceloc.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(serviceloc, serviceloc);
var target = new User("Bobby");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例8: TestThatServiceLocatorRemovesFlightWhenBooked
public void TestThatServiceLocatorRemovesFlightWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = new Flight(new DateTime(2000, 01, 01), new DateTime(2000, 01, 07), 5);
var remainingFlight = new Flight(new DateTime(2000,01,01), new DateTime(2000,01,07), 6);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic)
.SetValue(serviceLocator, serviceLocator);
var target = new User("Jimbo");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例9: ServiceLocator
public void TestThatUserDoesRemoveFlightsWhichAreBookedFromListOfAvailableFlightsInServiceLocatorSinceBookedFlightsHaveNoMoreRoomOnThemForOtherPeopleToBuyTicketsToFlyOnThem()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = new Flight(new DateTime(2011, 4, 15), new DateTime(2011, 4, 20), 1000);
var remainingFlight = new Flight(new DateTime(2011, 4, 5), new DateTime(2011, 4, 10), 1000);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例10: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = new Flight(DateTime.Now, DateTime.Now.AddDays(5), 1000);
var remainingFlight1 = new Flight(DateTime.Now.AddDays(2), DateTime.Now.AddDays(15), 1300);
var remainingFlight2 = new Flight(DateTime.Now.AddDays(5), DateTime.Now.AddDays(18), 700);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight1);
serviceLocator.AddFlight(remainingFlight2);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Shawn");
target.book(flightToBook);
Assert.AreEqual(2, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight1, ServiceLocator.Instance.AvailableFlights[0]);
Assert.AreSame(remainingFlight2, ServiceLocator.Instance.AvailableFlights[1]);
}
示例11: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
DateTime startDate1 = new DateTime(2012, 11, 1);
DateTime endDate1 = new DateTime(2012, 11, 4);
DateTime startDate2 = new DateTime(2013, 5, 12);
DateTime endDate2 = new DateTime(2013, 5, 28);
var flightToBook = new Flight(startDate1, endDate1, 5000);
var remainingFlight= new Flight(startDate2, endDate2, 8000);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(flightToBook);
Assert.AreEqual(serviceLocator.AvailableFlights.Count, 1);
Assert.AreSame(remainingFlight, serviceLocator.AvailableFlights[0]);
}
示例12: TestThatTwoFlightsNotEqual
public void TestThatTwoFlightsNotEqual()
{
var start = new DateTime(1999, 1, 1);
var end = new DateTime(1999, 1, 2);
int miles = 100;
var flight = new Flight(start, end, miles);
//var start1 = new DateTime(1999, 1, 1);
//var end1 = new DateTime(1999, 1, 4);
//int miles1 = 200;
var notFlight = new User("NotAFlight");
Assert.False(flight.Equals(notFlight));
}
示例13: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flighttoBook = new Flight(StartDate, EndDate, 12);
var flightRemaining = new Flight(StartDate, new DateTime(2010, 12, 12), 16);
serviceLocator.AddFlight(flighttoBook);
serviceLocator.AddFlight(flightRemaining);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic)
.SetValue(serviceLocator, serviceLocator);
var target = new User("Bob");
target.book(flighttoBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(flightRemaining, ServiceLocator.Instance.AvailableFlights[0]);
}
示例14: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
var flightToBook = ObjectMother.CoupleOfDaysFlight();
var remainingFlight = ObjectMother.LotsOfDaysFlight();
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Alice");
target.book(flightToBook);
Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
}
示例15: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked
public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
{
ServiceLocator serviceLocator = new ServiceLocator();
DateTime startDate = new DateTime();
DateTime endDate = startDate;
var flightToBook = new Flight(startDate, endDate, 10);
var remainingFlight = new Flight(startDate, endDate, 10);
serviceLocator.AddFlight(flightToBook);
serviceLocator.AddFlight(remainingFlight);
typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);
var target = new User("Bro");
target.book(flightToBook);
var availableFlights = ServiceLocator.Instance.AvailableFlights.Count;
var flightRemaining = ServiceLocator.Instance.AvailableFlights[0];
Assert.AreEqual(availableFlights, 1);
Assert.AreSame(flightRemaining, remainingFlight);
}