public async Task Test_Get_All()
        {
            var client   = new TestEducationClientProvider().Client;
            var response = await client.GetAsync("api/ClassLevel");

            response.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
示例#2
0
        public async Task Test_Get_OData()
        {
            var client   = new TestEducationClientProvider().Client;
            var response = await client.GetAsync("api/Type?$select=name,id");

            response.EnsureSuccessStatusCode();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
示例#3
0
        public async Task Test_Post_OData()
        {
            Faker    faker    = new Faker("tr");
            Category category = new Category()
            {
                Name       = faker.Commerce.Categories(1)[0],
                CreateDate = DateTime.Now,
                IsActive   = true
            };

            var client   = new TestEducationClientProvider().Client;
            var response = await client.PostAsync("api/Category", new StringContent(JsonConvert.SerializeObject(category), UnicodeEncoding.UTF8, "application/json"));

            response.EnsureSuccessStatusCode();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
示例#4
0
        public async Task Test_Post_OData()
        {
            Faker   faker   = new Faker("tr");
            Subject subject = new Subject()
            {
                Name       = faker.Lorem.Sentence(3),
                CreateDate = DateTime.Now,
                IsActive   = true
            };

            var client   = new TestEducationClientProvider().Client;
            var response = await client.PostAsync("api/Subject", new StringContent(JsonConvert.SerializeObject(subject), UnicodeEncoding.UTF8, "application/json"));

            response.EnsureSuccessStatusCode();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }
        public async Task Test_Post_OData()
        {
            Random random = new Random();

            Faker      faker      = new Faker("tr");
            ClassLevel classLevel = new ClassLevel()
            {
                Name           = faker.Lorem.Sentence(3),
                EducationLevel = random.Next(1, 81),
                CreateDate     = DateTime.Now,
                IsActive       = true
            };

            var client   = new TestEducationClientProvider().Client;
            var response = await client.PostAsync("api/ClassLevel", new StringContent(JsonConvert.SerializeObject(classLevel), UnicodeEncoding.UTF8, "application/json"));

            response.EnsureSuccessStatusCode();

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }