Ejemplo n.º 1
0
        public async Task AttendanceControllerCheckInFail()
        {
            var data    = new AttendanceApiDataHandler();
            var confirm = ModelConfirm <Attendance> .CreateFailure("Failed");

            data.Result.Setup(m => m.Execute(It.IsAny <AttendanceCheckin>())).Returns(false);

            data.ResultConfirm = confirm;

            var controller = new AttendanceController(data, Logic)
            {
                CurrentUser = AdminUser
            };
            var result = await controller.Checkin(MeetingData.FirstId, StandardUser.Id) as OkObjectResult;

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

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