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


C# User.book方法代码示例

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


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

示例1: 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]);
     target.book(remainingCar);
     Assert.IsEmpty(ServiceLocator.Instance.AvailableCars);
 }
开发者ID:galvezdm,项目名称:Lab4-galvezdm,代码行数:16,代码来源:UserTest.cs

示例2: 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);
 }
开发者ID:ilovllamas12,项目名称:Lab3-crouchjt,代码行数:7,代码来源:UserTest.cs

示例3: 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]);
 }
开发者ID:KimberlyBoucher,项目名称:Lab2-boucheka,代码行数:13,代码来源:UserTest.cs

示例4: 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]);
 }
开发者ID:HawaiianNinja,项目名称:Lab4-hopkinaj,代码行数:14,代码来源:UserTest.cs

示例5: 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]);
 }
开发者ID:stamptd,项目名称:Lab4-stamptd,代码行数:15,代码来源:UserTest.cs

示例6: 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]);
        }
开发者ID:cooperra,项目名称:Lab4-cooperra,代码行数:16,代码来源:UserTest.cs

示例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]);
        }
开发者ID:eatonmi,项目名称:Lab4-eatonmi,代码行数:16,代码来源:UserTest.cs

示例8: TestThatUserDoesRemoveCarFromServiceLocatorWhenBooked

        public void TestThatUserDoesRemoveCarFromServiceLocatorWhenBooked()
        {
            ServiceLocator serviceLocator = new ServiceLocator();
            var carToBook = new Car(1);
            var remainingCar = new Car(2);
            serviceLocator.AddCar(carToBook);
            serviceLocator.AddCar(remainingCar);

            typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);

            var target = new User("Dude");
            target.book(carToBook);

            var availableCars = ServiceLocator.Instance.AvailableCars.Count;
            var carRemaining = ServiceLocator.Instance.AvailableCars[0];
            Assert.AreEqual(availableCars, 1);
            Assert.AreSame(remainingCar, carRemaining);
        }
开发者ID:ycdfn,项目名称:Lab4-michaeaj,代码行数:18,代码来源:UserTest.cs

示例9: 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]);
        }
开发者ID:zhengc,项目名称:Lab4-zhengc,代码行数:19,代码来源:UserTest.cs

示例10: TestThatUserDoesRemoveCarFromServiceLocatorWhenBooked

 public void TestThatUserDoesRemoveCarFromServiceLocatorWhenBooked()
 {
     ServiceLocator serviceLocator = new ServiceLocator();
     var FlightToBook = new Flight(System.DateTime.MinValue, System.DateTime.MaxValue, 20);
     var remainingFlight = new Flight(System.DateTime.MinValue, System.DateTime.MaxValue, 15);
     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]);
 }
开发者ID:baroba,项目名称:Lab4-baroba,代码行数:14,代码来源:FlightTest.cs

示例11: 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]);
        }
开发者ID:davidov541,项目名称:Lab4-mcginnda,代码行数:16,代码来源:UserTest.cs

示例12: 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]);
        }
开发者ID:drakecb,项目名称:Lab4-drakecb,代码行数:22,代码来源:UserTest.cs

示例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]);
 }
开发者ID:mellinja,项目名称:Lab4-mellinja,代码行数:14,代码来源:FlightTest.cs

示例14: 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);
        }
开发者ID:ycdfn,项目名称:Lab4-michaeaj,代码行数:23,代码来源:UserTest.cs

示例15: TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked

        public void TestThatUserDoesRemoveFlightFromServiceLocatorWhenBooked()
        {
            ServiceLocator serviceLocator = new ServiceLocator();
            DateTime startDateForFirstFlight = new DateTime(2012, 03, 26);
            DateTime endDateForFirstFlight = new DateTime(2012, 05, 30);
            int milesForFirstFlight = 900;
            DateTime startDateForSecondFlight = new DateTime(2012, 07, 01);
            DateTime endDateForSecondFlight = new DateTime(2012, 07, 05);
            int milesForSecondFlight = 510;
            var flightToBook = new Flight(startDateForFirstFlight, endDateForFirstFlight, milesForFirstFlight);
            var remainingFlight = new Flight(startDateForSecondFlight, endDateForSecondFlight, milesForSecondFlight);
            serviceLocator.AddFlight(flightToBook);
            serviceLocator.AddFlight(remainingFlight);

            typeof(ServiceLocator).GetField("_instance", BindingFlags.Static | BindingFlags.NonPublic).SetValue(serviceLocator, serviceLocator);

            var target = new User("Sriram");
            target.book(flightToBook);

            Assert.AreEqual(1, ServiceLocator.Instance.AvailableFlights.Count);
            Assert.AreSame(remainingFlight, ServiceLocator.Instance.AvailableFlights[0]);
        }
开发者ID:ehines,项目名称:Lab4-hinesen,代码行数:22,代码来源:UserTest.cs


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