public void BookingSeats(Seance seance, ArrayList numbers)
        {
            string myContent = JsonConvert.SerializeObject(new
            {
                seanceId      = (string)seance.GetId().ToString(),
                reservedSeats = numbers,
            });

            DialogMessage.ShowInfo("Post: " + myContent);
            var content = new StringContent(myContent, Encoding.UTF8, "application/json");

            HttpClient client = AdressList.GetHttpClient();

            AdminAuthorization.SetAuthorization(client);
            HttpResponseMessage response = client.PostAsync(AdressList.Booking, content).Result;

            if (response.StatusCode == HttpStatusCode.Created)
            {
                NotifitactionForm.ShowMessage("Wysłany element: " + "Rezerwacja");
            }
            else
            {
                DialogMessage.ShowInfo("Błąd wysyłania elementu: " + "Rezerwacja");
            }
        }
Ejemplo n.º 2
0
        public void AAdminShouldBeAbleToReadAllJsonFilesInRoleBasedSecurityContext()
        {
            IFileReader   fileReader         = new JsonFileReader();
            Authorization adminAuthorization = new AdminAuthorization(fileReader);

            var filename = $@"{_currentDirectory}\files\admin.json";

            var actual = adminAuthorization.Read(filename);

            Assert.AreEqual("{\r\n  \"text\": \"Hello admin!\"\r\n}", actual.ToString());
        }
Ejemplo n.º 3
0
        public void AAdminShouldBeAbleToReadAllXMLFilesInRoleBasedSecurityContext()
        {
            IFileReader   fileReader         = new XmlFileReader();
            Authorization adminAuthorization = new AdminAuthorization(fileReader);

            var filename = $@"{_currentDirectory}\files\admin.xml";

            var actual = XElement.Parse(adminAuthorization.Read(filename));

            var expected = XElement.Parse("<?xml version=\"1.0\"?><text>Hello admin!</text>");

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
        public void SendComment(Comment comment)
        {
            HttpClient client = AdressList.GetHttpClient();

            AdminAuthorization.SetAuthorization(client);
            var content = ContentCreator.CreateContent(comment);
            HttpResponseMessage response = client.PostAsync(AdressList.Comments, content).Result;

            if (response.StatusCode == HttpStatusCode.Created)
            {
                NotifitactionForm.ShowMessage("Wysłany element: " + "Komentarz");
            }
            else
            {
                DialogMessage.ShowInfo("Błąd wysyłania elementu: " + "Komentarz");
            }
        }