コード例 #1
0
ファイル: VisibleControllerTest.cs プロジェクト: rog1039/crux
        public async Task VisibleControllerDisplayNotFound()
        {
            var data = new VisibleApiDataHandler();

            data.Result.Setup(m => m.Execute(It.IsAny <VisibleDisplayById>())).Returns(null);

            var controller = new VisibleController(data, Cloud, Logic)
            {
                CurrentUser = StandardUser
            };
            var result = await controller.Display(VisibleData.FirstId) as NotFoundResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <NotFoundResult>();

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <VisibleDisplayById>()), Times.Once());
        }
コード例 #2
0
ファイル: VisibleControllerTest.cs プロジェクト: rog1039/crux
        public async Task VisibleControllerDisplayUnauthorized()
        {
            var data    = new VisibleApiDataHandler();
            var display = VisibleData.GetFirstDisplay();

            data.Result.Setup(m => m.Execute(It.IsAny <VisibleDisplayById>())).Returns(display);

            var controller = new VisibleController(data, Cloud, Logic)
            {
                CurrentUser = NonTenantUser
            };
            var result = await controller.Display(VisibleData.FirstId) as UnauthorizedResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <UnauthorizedResult>();

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <VisibleDisplayById>()), Times.Once());
        }
コード例 #3
0
ファイル: VisibleControllerTest.cs プロジェクト: rog1039/crux
        public async Task VisibleControllerDisplay()
        {
            var data    = new VisibleApiDataHandler();
            var display = VisibleData.GetFirstDisplay();

            data.Result.Setup(m => m.Execute(It.IsAny <VisibleDisplayById>())).Returns(display);

            var controller = new VisibleController(data, Cloud, Logic)
            {
                CurrentUser = StandardUser
            };
            var result = await controller.Display(VisibleData.FirstId) as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            Assert.That(result.Value, Is.DeepEqualTo(display));

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <VisibleDisplayById>()), Times.Once());
        }