Пример #1
0
        public void Nonexisting_user_login()
        {
            using var scope = _factory.Services.CreateScope();
            var controller = new LearnerController(_factory.Services.GetRequiredService <IMapper>(),
                                                   scope.ServiceProvider.GetRequiredService <ILearnerService>());
            var loginSubmission = new LoginDTO {
                StudentIndex = "SA-1-2021"
            };

            var code = ((NotFoundObjectResult)controller.Login(loginSubmission).Result).StatusCode;

            code.ShouldBe(404);
        }
Пример #2
0
        public void Successfully_logins()
        {
            using var scope = _factory.Services.CreateScope();
            var controller = new LearnerController(_factory.Services.GetRequiredService <IMapper>(),
                                                   scope.ServiceProvider.GetRequiredService <ILearnerService>());
            var loginSubmission = new LoginDTO {
                StudentIndex = "SU-1-2021"
            };

            var learner = ((OkObjectResult)controller.Login(loginSubmission).Result).Value as LearnerDTO;

            learner.Id.ShouldBe(1);
        }