Ejemplo n.º 1
0
        public async Task MeetingTypeControllerDisplayNull()
        {
            var data = new MeetingTypeApiDataHandler();

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

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

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

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <MeetingTypeDisplayById>()), Times.Once());
        }
Ejemplo n.º 2
0
        public async Task MeetingTypeControllerDisplayUnauthorized()
        {
            var data    = new MeetingTypeApiDataHandler();
            var display = MeetingTypeData.GetFirstDisplay(false);

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

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

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

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <MeetingTypeDisplayById>()), Times.Once());
        }
Ejemplo n.º 3
0
        public async Task MeetingTypeControllerDisplay()
        {
            var data    = new MeetingTypeApiDataHandler();
            var display = MeetingTypeData.GetFirstDisplay(false);

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

            var controller = new MeetingTypeController(data, Logic)
            {
                CurrentUser = AdminUser
            };
            var result = await controller.Display(MeetingTypeData.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 <MeetingTypeDisplayById>()), Times.Once());
        }