<commit_before>﻿using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;

using NUnit.Framework;

namespace KenticoCloud.Deliver.Tests
{
    [TestFixture]
    public class DeliverClientTests
    {
        private const string PROJECT_ID = "ac9df07a-1251-4721-9ccf-6935ad5b6c1f";

        [Test]
        public void GetItemAsync()
        {
            var client = new DeliverClient(PROJECT_ID);

            var item = Task.Run(() => client.GetItemAsync("sdk_test_item")).Result.Item;

            Assert.AreEqual("sdk_test_item", item.System.Codename);

            var textElement = item.GetString("text");
            var richTextElement = item.GetString("rich_text");
            var numberElement = item.GetNumber("number");
            var datetimeElement = item.GetDateTime("datetime");
            var assetElement = item.GetAssets("assets");
            var modularContentElement = item.GetModularContent("modular_content");

            Assert.AreEqual("random textz", textElement);
            Assert.AreEqual("<p>this is <strong>rich</strong>!</p>", richTextElement);
            Assert.AreEqual(21.63, numberElement);
            Assert.AreEqual(DateTime.Parse("21.10.2016 0:00:00"), datetimeElement);
            Assert.AreEqual(2, assetElement.Count);
            Assert.AreEqual(4, modularContentElement.Count());
        }


        [Test]
        public void GetItemAsync_NonExistentCodename()
        {
            var client = new DeliverClient(PROJECT_ID);

            var response = Task.Run(() => client.GetItemAsync("sdk_test_item_non_existent")).Result;

            Assert.IsNotNull(response);
        }


        [Test]
        public void GetItemsAsync()
        {
            var client = new DeliverClient(PROJECT_ID);

            var filters = new List<IFilter> { new EqualsFilter("system.type", "sdk_test_type") };

            var response = Task.Run(() => client.GetItemsAsync(filters)).Result;

            Assert.IsNotNull(response);
        }
    }
}
<commit_msg>fixed tests<commit_after>﻿using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;

using NUnit.Framework;

namespace KenticoCloud.Deliver.Tests
{
	[TestFixture]
	public class DeliverClientTests
	{
		private const string PROJECT_ID = "e391c776-9d1e-4e1a-8a5a-1c327c2586b6";

		[Test]
		public void GetItemAsync()
		{
			// Arrange
			var client = new DeliverClient(PROJECT_ID);

			// Act
			var item = Task.Run(() => client.GetItemAsync("coffee_beverages_explained")).Result.Item;

			var textElement = item.GetString("title");
			var richTextElement = item.GetString("body_copy");
			var datetimeElement = item.GetDateTime("post_date");
			var assetElement = item.GetAssets("teaser_image");
			var modularContentElement = item.GetModularContent("related_articles");

			// Assert
			Assert.AreEqual("article", item.System.Type);
			Assert.AreEqual("Coffee Beverages Explained", textElement);
			Assert.That(() => richTextElement.Contains("Caffeine: &lt; 100 mg/cup<br/>"));
			Assert.AreEqual(DateTime.Parse("18.11.2014 0:00:00"), datetimeElement);
			Assert.AreEqual(1, assetElement.Count);
			Assert.AreEqual(0, modularContentElement.Count());
		}


		[Test]
		public void GetItemAsync_NonExistentCodename()
		{
			// Arrange
			var client = new DeliverClient(PROJECT_ID);

			// Act
			AsyncTestDelegate d = async () => await client.GetItemAsync("sdk_test_item_non_existent");

			// Assert
			Assert.ThrowsAsync<DeliverException>(d);
		}


		[Test]
		public void GetItemsAsync()
		{
			// Arrange
			var client = new DeliverClient(PROJECT_ID);
			var filters = new List<IFilter> { new EqualsFilter("system.type", "cafe") };

			// Act
			var response = Task.Run(() => client.GetItemsAsync(filters)).Result;

			// Assert
			Assert.IsNotNull(response);
			Assert.GreaterOrEqual(response.Items.Count, 1);
		}
	}
}

{'fraction_non_alphanumeric': 0.12458344014355294, 'fraction_numerical': 0.01999487310945911, 'mean_word_length': 3.195698924731183, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3099913', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1178, 'n_words': 214}