Пример #1
0
        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
        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
        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());
        }