示例#1
0
        public void WhenUserIsAttemptedToBeSetUpAsATeacher()
        {
            var userId   = ScenarioCache.GetUserId();
            var response = ApiCaller.Post <ActionReponse <TeacherModel> >(Routes.GetTeacherById(userId));

            ScenarioCache.StoreActionResponse(response);
        }
        public void GivenTheUserDoesWantToReceiveEmails()
        {
            var response = ApiCaller.Delete <ActionReponse <UserModel> >(
                Routes.GetDoNotEmailUser(ScenarioCache.GetUserId()));

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
示例#3
0
        public void ThenTheUsersDetailsCanNotBeRetrieved()
        {
            var userResponse = ApiCaller.Get <List <UserModel> >(Routes.Users);

            Assert.AreEqual(HttpStatusCode.OK, userResponse.StatusCode);

            Assert.IsEmpty(userResponse.Data.Where(x => x.Id == ScenarioCache.GetUserId()));
        }
示例#4
0
        public void ThenUserStillExists()
        {
            var allUsers = UserFunction.GetAllUsers();

            var matchingUser = allUsers.SingleWithId(ScenarioCache.GetUserId());

            Assert.IsNotNull(matchingUser);
        }
示例#5
0
        public void ThenTheUsersTermAndConditionsAgreementIsRecorded()
        {
            var userId = ScenarioCache.GetUserId();

            var response = ApiCaller.Get <UserModel>(Routes.GetUserById(userId));

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsTrue(response.Data.AgreesToTerms);
        }
示例#6
0
        public void GivenABlockExistsThatIsFull()
        {
            GivenABlockExistsWithAStudentLimitOf(1);

            var userId = ScenarioCache.GetUserId();

            GivenTheUserEnrolsInTheBlock();

            ScenarioCache.Store(ModelIdKeys.UserId, userId);
        }
示例#7
0
        public void ThenTheUserSDetailsCanBeRetrieved()
        {
            var userResponse = ApiCaller.Get <List <UserModel> >(Routes.Users);

            Assert.AreEqual(HttpStatusCode.OK, userResponse.StatusCode);

            var createdUser  = userResponse.Data.SingleWithId(ScenarioCache.GetUserId());
            var expectedUser = ScenarioCache.Get <UserModel>(ExpectedUserKey);

            new VerifyUserProperties(expectedUser, createdUser)
            .Verify();
        }
示例#8
0
        public void WhenTheUserPurchasesAPassThatDoesntExistFromATeacher()
        {
            var pass = new PassModel
            {
                PaymentStatus = PassPaymentStatus.Paid.ToString()
            };

            var url      = Routes.GetPassPurchase(ScenarioCache.GetUserId(), 2);
            var response = ApiCaller.Post <ActionReponse <UserModel> >(pass, url);

            ScenarioCache.StoreActionResponse(response);
        }
示例#9
0
        private static void BuyPass()
        {
            new CommonUserSteps().GivenAUserExists();

            var userId     = ScenarioCache.GetUserId();
            var studentIds = ScenarioCache.Get <List <int> >(ModelIdKeys.StudentIds);

            studentIds.Add(userId);
            ScenarioCache.Store(ModelIdKeys.StudentIds, studentIds);

            var purchasePassSteps = new PurchasePassSteps();

            purchasePassSteps.WhenTheUserPurchasesAPassFromATeacher();
            purchasePassSteps.ThenTheUserHasAPass();
            purchasePassSteps.ThenThePassIsPaid();
            purchasePassSteps.ThenThePassIsValid();
        }
示例#10
0
        public void WhenTheUserTriesToEnrolInTheBlock()
        {
            var response = ApiCaller.Post <ActionReponse <UserModel> >(new EnrolmentModel(ScenarioCache.GetId(ModelIdKeys.BlockId)),
                                                                       Routes.GetEnrolUserInBlock(ScenarioCache.GetUserId()));

            ScenarioCache.StoreActionResponse(response);
        }
示例#11
0
        public void WhenTheUserPurchasesAPassFromATeacher()
        {
            var pass = new PassModel
            {
                PaymentStatus = PassPaymentStatus.Paid.ToString()
            };
            var response = ApiCaller.Post <ActionReponse <UserModel> >(pass,
                                                                       Routes.GetPassPurchase(ScenarioCache.GetUserId(), ScenarioCache.GetId(ModelIdKeys.PassTemplateId)));

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
        }
        public void WhenTheUserRegistersForTheStandAloneEvent()
        {
            var response = ApiCaller.Post <ActionReponse <UserModel> >(new EventRegistrationModel(ScenarioCache.GetId(ModelIdKeys.StandAloneEventId)),
                                                                       Routes.GetRegisterUserInEvent(ScenarioCache.GetUserId()));

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
示例#13
0
        public void GivenTheUserEnrolsInBlocks(int numberOfBlocks)
        {
            for (int blockId = 1; blockId <= numberOfBlocks; blockId++)
            {
                var response = ApiCaller.Post <ActionReponse <UserModel> >(new EnrolmentModel(blockId),
                                                                           Routes.GetEnrolUserInBlock(ScenarioCache.GetUserId()));

                Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            }
        }
示例#14
0
        public void GivenTheUserEnrolsInTheBlock()
        {
            var response = ApiCaller.Post <ActionReponse <UserModel> >(new EnrolmentModel(ScenarioCache.GetId(ModelIdKeys.BlockId)),
                                                                       Routes.GetEnrolUserInBlock(ScenarioCache.GetUserId()));

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
示例#15
0
        public void WhenTheirClaimsAreRetrieved()
        {
            var response = ApiCaller.Get <List <string> >(Routes.GetUserClaims(ScenarioCache.GetUserId()));

            ScenarioCache.Store(ClaimsResponseKey, response);
        }
示例#16
0
        public void WhenTheUserScheduleIsRetrieved()
        {
            var response = ApiCaller.Get <List <EventModel> >(Routes.GetUserSchedule(ScenarioCache.GetUserId()));

            ScenarioCache.Store(ScheduleResponseKey, response);
        }
示例#17
0
        public void WhenTheUserIsDeleted()
        {
            var response = ApiCaller.Delete <UserModel>(Routes.GetById(Routes.Users, ScenarioCache.GetUserId()));

            ScenarioCache.StoreResponse(response);
        }