public TestParameters(bool canDeactivate, bool isAuthorized, object newViewModel, RouteRequest routeRequest = null)
 {
     CanDeactivate = canDeactivate;
     IsAuthorized  = isAuthorized;
     NewViewModel  = newViewModel;
     RouteRequest  = routeRequest ?? new RouteRequest("uri", null, ViewportOptions.MainViewport(), new ClaimsPrincipal());
 }
    public async Task ViewAwareVmReceivesView()
    {
        _fixture.GetMock <IViewAwareVm>()
        .Setup(z => z.LoadView(It.IsAny <object>()))
        .Verifiable();

        var routeRequest = new RouteRequest("", (decimal)25, ViewportOptions.MainViewport(), new ClaimsPrincipal());

        var parameters = new TestParameters(canDeactivate: true, isAuthorized: true,
                                            newViewModel: _viewAwareViewModel,
                                            routeRequest: routeRequest);
        var routeResult = await RunTest(parameters);

        routeResult.Success.Should().Be(true);
        routeResult.StatusCode.Should().Be(RouteResultStatusCode.OK);

        _fixture.GetMock <IViewAwareVm>()
        .Verify();
    }
    public async Task Init1ParamsReturnsVoid()
    {
        _fixture.GetMock <IViewModelInit1ParamsReturnsTask>()
        .Setup(z => z.Init(It.IsAny <decimal>()))
        .Returns(() => Task.CompletedTask);

        var routeRequest = new RouteRequest("", (decimal)25, ViewportOptions.MainViewport(), new ClaimsPrincipal());

        var parameters = new TestParameters(canDeactivate: true, isAuthorized: true,
                                            newViewModel: _viewModelInit1ParamsReturnsTask,
                                            routeRequest: routeRequest);
        var routeResult = await RunTest(parameters);

        routeResult.Success.Should().Be(true);
        routeResult.StatusCode.Should().Be(RouteResultStatusCode.OK);

        _fixture.GetMock <IViewModelInit1ParamsReturnsTask>()
        .Verify();
    }
Ejemplo n.º 4
0
 private void NavigateToOneMain()
 {
     var result = _routerService.RouteAsync("/control1", null, ViewportOptions.MainViewport(), null);
 }