public static void ClassInitialize(TestContext context)
        {
            ServiceLocator.Current.SetService<INavigationService>(new StubINavigationService());

            StubIViewService viewService =
                new StubIViewService()
                {
                    ExecuteBusyActionAsyncFuncOfTask =
                        async (Func<Task> func) =>
                        {
                            await func();
                        }
                };
            ServiceLocator.Current.SetService<IViewService>(viewService);
        }
示例#2
0
        public static void ClassInitialize(TestContext context)
        {
            ServiceLocator.Current.SetService <INavigationService>(new StubINavigationService());

            StubIViewService viewService =
                new StubIViewService()
            {
                ExecuteBusyActionAsyncFuncOfTask =
                    async(Func <Task> func) =>
                {
                    await func();
                }
            };

            ServiceLocator.Current.SetService <IViewService>(viewService);
        }
示例#3
0
    public async Task TestMethod1()
    {
      ServiceLocator.Current.SetService<INavigationService>(
        new StubINavigationService());

      StubIViewService viewService =
        new StubIViewService()
        {
          ExecuteBusyActionAsyncFuncOfTask =
              async (Func<Task> func) =>
              {
                await func();
              }
        };
      ServiceLocator.Current.SetService<IViewService>(viewService);

      StubIExpenseRepository repository =
        new StubIExpenseRepository()
        {
          GetChargeAsyncInt32 =
              (chargeId) =>
              {
                return Task.FromResult(
                    new Charge()
                    {
                      ChargeId = chargeId,
                    });
              }
        };
      ServiceLocator.Current.SetService<IExpenseRepository>(repository);




      // Create a new ChargeViewModel.
      ChargeViewModel chargeViewModel = new ChargeViewModel();

      // Make sure it defaults to a ChargeId of 0.
      Assert.AreEqual(0, chargeViewModel.ChargeId);

      // Load the charge with the ChargeId of 1.
      await chargeViewModel.LoadAsync(1);

      // Confirm the ViewModel’s ChargeId is 1.
      Assert.AreEqual(1, chargeViewModel.ChargeId);

    }
示例#4
0
        public async Task TestMethod1()
        {
            ServiceLocator.Current.SetService <INavigationService>(
                new StubINavigationService());

            StubIViewService viewService =
                new StubIViewService()
            {
                ExecuteBusyActionAsyncFuncOfTask =
                    async(Func <Task> func) =>
                {
                    await func();
                }
            };

            ServiceLocator.Current.SetService <IViewService>(viewService);

            StubIExpenseRepository repository =
                new StubIExpenseRepository()
            {
                GetChargeAsyncInt32 =
                    (chargeId) =>
                {
                    return(Task.FromResult(
                               new Charge()
                    {
                        ChargeId = chargeId,
                    }));
                }
            };

            ServiceLocator.Current.SetService <IExpenseRepository>(repository);



            // Create a new ChargeViewModel.
            ChargeViewModel chargeViewModel = new ChargeViewModel();

            // Make sure it defaults to a ChargeId of 0.
            Assert.AreEqual(0, chargeViewModel.ChargeId);

            // Load the charge with the ChargeId of 1.
            await chargeViewModel.LoadAsync(1);

            // Confirm the ViewModel’s ChargeId is 1.
            Assert.AreEqual(1, chargeViewModel.ChargeId);
        }