<commit_before>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenBook;

namespace OpenBookNetUnitTest
{
    /// <summary>
    /// Markets related unit tests
    /// </summary>
    [TestClass]
    public class MarketsUnitTests
    {
        private readonly OpenBookClient _client = new OpenBookClient();

        [TestMethod]
        public void GetFeaturedSymbols()
        {
            var result = _client.GetFeaturedSymbols().Result;

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Categories);
            Assert.IsNotNull(result.FeaturedSymbols);

            foreach (var category in result.Categories)
            {
                Assert.IsNotNull(category);
                Assert.IsNotNull(category.Symbols);
                foreach (var symbol in category.Symbols)
                {
                    Assert.IsNotNull(symbol.Symbol);
                    Assert.IsNotNull(symbol.SymbolRatesModel);
                }
            }

            foreach (var featuredSymbol in result.FeaturedSymbols)
            {
                Assert.IsNotNull(featuredSymbol);
                Assert.IsNotNull(featuredSymbol.Symbol);
                Assert.IsNotNull(featuredSymbol.SymbolRatesModel);
            }
        }

        [TestMethod]
        public void GetTopStocks()
        {
            throw new NotImplementedException();
        }

        [TestMethod]
        public void GetTopIndices()
        {
            throw new NotImplementedException();
        }

        [TestMethod]
        public void GetTopCurrencies()
        {
            throw new NotImplementedException();
        }

        [TestMethod]
        public void GetTopCommodities()
        {
            throw new NotImplementedException();
        }

        [TestMethod]
        public void GetCurrencyFeed()
        {
            throw new NotImplementedException();
        }

        [TestMethod]
        public void GetCommodityFeed()
        {
            throw new NotImplementedException();
        }<commit_msg>unit test for the different featured market symbol categories<commit_after>﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenBook;
using OpenBook.Models.ApiResults;

namespace OpenBookNetUnitTest
{
    /// <summary>
    /// Markets related unit tests
    /// </summary>
    [TestClass]
    public class MarketsUnitTests
    {
        private readonly OpenBookClient _client = new OpenBookClient();

        [TestMethod]
        public void GetFeaturedSymbols()
        {
            var result = _client.GetFeaturedSymbols().Result;

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Categories);
            Assert.IsNotNull(result.FeaturedSymbols);

            foreach (var category in result.Categories)
            {
                Assert.IsNotNull(category);
                Assert.IsNotNull(category.Symbols);
                foreach (var symbol in category.Symbols)
                {
                    Assert.IsNotNull(symbol.Symbol);
                    Assert.IsNotNull(symbol.SymbolRatesModel);
                }
            }

            foreach (var featuredSymbol in result.FeaturedSymbols)
            {
                Assert.IsNotNull(featuredSymbol);
                Assert.IsNotNull(featuredSymbol.Symbol);
                Assert.IsNotNull(featuredSymbol.SymbolRatesModel);
            }
        }

        [TestMethod]
        public void GetTopStocks()
        {
            var result = _client.GetFeaturedSymbols(MarketCategory.Stocks).Result;
            CheckCategorizedFeaturedSymbol(result);
        }

        [TestMethod]
        public void GetTopCurrencies()
        {
            var result = _client.GetFeaturedSymbols(MarketCategory.Currencies).Result;
            CheckCategorizedFeaturedSymbol(result);
        }

        [TestMethod]
        public void GetTopCommodities()
        {
            var result = _client.GetFeaturedSymbols(MarketCategory.Commodities).Result;
            CheckCategorizedFeaturedSymbol(result);
        }

        [TestMethod]
        public void GetCurrencyFeed()
        {
            throw new NotImplementedException();
        }

        [TestMethod]
        public void GetCommodityFeed()
        {
            throw new NotImplementedException();
        }

        private void CheckCategorizedFeaturedSymbol(MarketCategoriesResult result)
        {
            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Symbols);

            foreach (var symbol in result.Symbols)
            {
                Assert.IsNotNull(symbol);
                Assert.IsNotNull(symbol.Symbol);
                Assert.IsNotNull(symbol.SymbolRatesModel);
                Assert.IsNotNull(symbol.SymbolRatesModel.Rates);
            }
        }
{'fraction_non_alphanumeric': 0.07724166494098157, 'fraction_numerical': 0.0, 'mean_word_length': 1.7396483267158254, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1996123', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1152, 'n_words': 217}