예제 #1
0
        public async Task Add_Kategoria_And_Check_Count()
        {
            // Arrange
            var client    = _factory.CreateClient();
            var apiCaller = new KategoriaApiCaller(client);

            var tokens = await Authenticate(client).ConfigureAwait(false);

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokens.Token);

            await apiCaller.DodajKategorie(KategoriaObjectMother.GetKategoria());

            var categories = await apiCaller.GetKategorieList();

            Assert.That(categories, Is.Not.Null);
            Assert.That(categories, Has.Count.EqualTo(1));
        }
예제 #2
0
        public async Task DeleteKategoria()
        {
            // Arrange
            var client    = _factory.CreateClient();
            var apiCaller = new KategoriaApiCaller(client);

            var tokens = await Authenticate(client).ConfigureAwait(false);

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokens.Token);

            var id = await apiCaller.DodajKategorie(KategoriaObjectMother.GetKategoria());

            var categoriesBeforeDeletion = await apiCaller.GetKategorieList();

            var deleteResponse = await apiCaller.UsunKategorie(id);

            Assert.That(deleteResponse.StatusCode, Is.EqualTo(HttpStatusCode.NoContent));

            var categoriesAfterDeletionCount = (await apiCaller.GetKategorieList()).Count;

            Assert.That(categoriesAfterDeletionCount, Is.EqualTo(categoriesBeforeDeletion.Count - 1));
        }