Пример #1
0
        protected override async Task TestPutAtRoot()
        {
            Uri uri      = new Uri(FBaseUri, "StudentLedger");
            var response = await FClient.PutAsJsonAsync(uri.ToString(), FLedgers[0]);

            await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
        }
Пример #2
0
        protected override async Task TestPut()
        {
            Uri uri = new Uri(FBaseUri, "StudentTimesInOut/ABC");

            var t        = new SimpleStudentTimesPoco();
            var response = await FClient.PutAsJsonAsync(uri.ToString(), t);

            await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
        }
Пример #3
0
 protected override async Task TestPut()
 {
     if (FStudentMarks.Count > 0)
     {
         var sm       = FStudentMarks[0];
         Uri uri      = new Uri(FBaseUri, string.Format("StudentMarks/{0}", sm.GetId()));
         var response = await FClient.PutAsJsonAsync(uri.ToString(), sm);
         await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
     }
 }
Пример #4
0
        protected override async Task TestPutAtRoot()
        {
            if (FNewlyInsertedDefinitions.Count > 0)
            {
                var md = FNewlyInsertedDefinitions[0];
                md.Description = GetRandomString(50, true);

                Uri uri      = new Uri(FBaseUri, "MarkDefinitions");
                var response = await FClient.PutAsJsonAsync(uri.ToString(), md);
                await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
            }
        }
Пример #5
0
        protected override async Task TestPut()
        {
            if (FRegSummaries.Count > 0)
            {
                var summary = FRegSummaries[0];
                summary.StartDateTime = summary.StartDateTime.AddHours(-1);

                Uri uri      = new Uri(FBaseUri, string.Format("RegisterSummaries/{0}", summary.GetId()));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), summary);
                await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
            }
        }
Пример #6
0
        protected override async Task TestPutAtRoot()
        {
            if (FNewlyInsertedOLAMarks.Count > 0)
            {
                var m = FNewlyInsertedOLAMarks[0];
                m.Session = FRandom.Next();

                Uri uri      = new Uri(FBaseUri, "OLAStaging");
                var response = await FClient.PutAsJsonAsync(uri.ToString(), m);
                await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
            }
        }
Пример #7
0
        protected override async Task TestPutAtRoot()
        {
            if (FRegisters.Count > 0)
            {
                var reg = FRegisters[0];
                reg.Modified = true;

                Uri uri      = new Uri(FBaseUri, "Registers");
                var response = await FClient.PutAsJsonAsync(uri.ToString(), reg);
                await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
            }
        }
Пример #8
0
        protected override async Task TestPutAtRoot()
        {
            if (FNewlyInsertedExceptions.Count > 0)
            {
                var e = FNewlyInsertedExceptions[0];
                e.Comments = GetRandomString(50, true);
                e.Modified = true;

                Uri uri      = new Uri(FBaseUri, "StudentExceptions");
                var response = await FClient.PutAsJsonAsync(uri.ToString(), FNewlyInsertedExceptions[0]);
                await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
            }
        }
Пример #9
0
        protected override async Task TestPutNonExistingItem()
        {
            if (FNewlyInsertedExceptions.Count > 0)
            {
                var ex = FNewlyInsertedExceptions[0];

                int origId = ex.ExceptionId;
                ex.ExceptionId = BAD_INT_ID;
                Uri uri      = new Uri(FBaseUri, string.Format("StudentExceptions/{0}", ex.ExceptionId));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), ex);

                ex.ExceptionId = origId;
                await CheckStatusCodeIs(response, HttpStatusCode.NotFound);
            }
        }
Пример #10
0
        protected override async Task TestPutNonExistingItem()
        {
            if (FRegSummaries.Count > 0)
            {
                var summary = FRegSummaries[0];

                string origId = summary.Id;
                summary.Id = "12345678";

                Uri uri      = new Uri(FBaseUri, string.Format("RegisterSummaries/{0}", summary.GetId()));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), summary);

                summary.Id = origId;
                await CheckStatusCodeIs(response, HttpStatusCode.MethodNotAllowed);
            }
        }
Пример #11
0
        protected override async Task TestPutNonExistingItem()
        {
            // make changes to a non-existing def...

            if (FNewlyInsertedDefinitions.Count > 0)
            {
                var md     = FNewlyInsertedDefinitions[0];
                int origId = md.Id;
                md.Id = BAD_INT_ID;
                Uri uri      = new Uri(FBaseUri, string.Format("MarkDefinitions/{0}", md.Id));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), md);

                md.Id = origId;
                await CheckStatusCodeIs(response, HttpStatusCode.NotFound);
            }
        }
Пример #12
0
        private async Task TestPut1(Register reg, bool activityExistsInOriginal)
        {
            if (reg != null)
            {
                // change register notes...
                reg.RegisterNotes = GetRandomString(50, true);
                reg.Modified      = true;

                Uri uri = new Uri(FBaseUri, string.Format("Registers/{0}", reg.GetId()));

                var response = await FClient.PutAsJsonAsync(uri.ToString(), reg);
                await CheckSuccessStatusCode(response);

                var regRetVal = await response.Content.ReadAsAsync <Register>();

                regRetVal.CheckSameValues(reg, activityExistsInOriginal);
            }
        }
Пример #13
0
        protected override async Task TestPut()
        {
            // make changes to the newly added defs...

            foreach (var md in FNewlyInsertedOLAMarks)
            {
                // change session...
                md.Session = FRandom.Next();

                Uri uri      = new Uri(FBaseUri, string.Format("OLAStaging/{0}", md.Id));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), md);
                await CheckSuccessStatusCode(response);

                var mdRetVal = await response.Content.ReadAsAsync <OlaMark>();

                md.CheckSameValues(mdRetVal);
            }
        }
Пример #14
0
        protected override async Task TestPut()
        {
            // make changes to the newly added defs...

            foreach (var md in FNewlyInsertedDefinitions)
            {
                // change description...
                md.Description = GetRandomString(50, true);

                Uri uri      = new Uri(FBaseUri, string.Format("MarkDefinitions/{0}", md.Id));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), md);
                await CheckSuccessStatusCode(response);

                var mdRetVal = await response.Content.ReadAsAsync <MarkDefinition>();

                md.CheckSameValues(mdRetVal);
            }
        }
Пример #15
0
        protected override async Task TestPut()
        {
            // make changes to the newly added exceptions...

            foreach (var e in FNewlyInsertedExceptions)
            {
                // change description...
                e.Comments = GetRandomString(50, true);
                e.Modified = true;

                Uri uri      = new Uri(FBaseUri, string.Format("StudentExceptions/{0}", e.ExceptionId));
                var response = await FClient.PutAsJsonAsync(uri.ToString(), e);
                await CheckSuccessStatusCode(response);

                var retVal = await response.Content.ReadAsAsync <ExceptionMark>();

                e.CheckSameValues(retVal);
            }
        }
Пример #16
0
        private async Task TestPut2()
        {
            var reg = FindRegisterWithStudentMarks();

            if (reg == null)
            {
                throw new Exception("Could not find register with student marks!");
            }

            var sm = reg.StudentMarks[0];

            sm.Comments = GetRandomString(40, true);
            sm.Modified = true;

            Uri uri      = new Uri(FBaseUri, string.Format("Registers/{0}", reg.GetId()));
            var response = await FClient.PutAsJsonAsync(uri.ToString(), reg);

            await CheckSuccessStatusCode(response);

            var regRetVal = await response.Content.ReadAsAsync <Register>();

            regRetVal.CheckSameValues(reg, reg.ActivityId > 0);
        }
Пример #17
0
        protected override async Task TestPutNonExistingItem()
        {
            if (FRegisters.Count > 0)
            {
                var reg = FRegisters[0];

                int origEventId = reg.EventId;
                int origWeek    = reg.Week;

                reg.RegisterNotes = GetRandomString(50, true);
                reg.Modified      = true;

                reg.SetId(123456, 4);

                Uri uri = new Uri(FBaseUri, string.Format("Registers/{0}", reg.GetId()));

                var response = await FClient.PutAsJsonAsync(uri.ToString(), reg);

                reg.EventId = origEventId;
                reg.Week    = origWeek;

                await CheckStatusCodeIs(response, HttpStatusCode.InternalServerError); // week or event ID not valid
            }
        }