<commit_before>﻿using FamilySearch.Api.Ft;
using Gx.Rs.Api;
using Gx.Source;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Gx.Rs.Api.Util;
using Gx.Records;
using Gedcomx.Support;
using FamilySearch.Api;
using Gx.Rs.Api.Options;

namespace Gedcomx.Rs.Api.Test
{
    [TestFixture]
    public class SourceBoxTests
    {
        private CollectionState collection;
        private CollectionsState subcollections;

        [TestFixtureSetUp]
        public void Initialize()
        {
            collection = new FamilySearchCollectionState(new Uri("https://sandbox.familysearch.org/platform/collections/sources"));
            collection.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId);
            subcollections = (CollectionsState)collection.ReadSubcollections().Get();
        }

        [Test]
        [Ignore("Unable to query all sources for all collections at this time.")]
        public void TestReadAllSourcesOfAllUserDefinedCollectionsOfASpecificUser()
        {
            // Get the root collection
            var subcollection = subcollections.ReadCollection(subcollections.Entity.Collections.Single(x => string.IsNullOrEmpty(x.Title)));
            subcollection = (CollectionState)subcollection.Get();
            var state = subcollection.ReadSourceDescriptions();

            Assert.DoesNotThrow(() => subcollection.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.OK, subcollection.Response.StatusCode);
            Assert.IsNotNull(subcollection.Entity.Collections);
            Assert.Greater(subcollection.Entity.Collections.Count, 0);
        }

        [Test]<commit_msg>Enabled previously disabled test (needed link has been added).<commit_after>﻿using FamilySearch.Api.Ft;
using Gx.Rs.Api;
using Gx.Source;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Gx.Rs.Api.Util;
using Gx.Records;
using Gedcomx.Support;
using FamilySearch.Api;
using Gx.Rs.Api.Options;

namespace Gedcomx.Rs.Api.Test
{
    [TestFixture]
    public class SourceBoxTests
    {
        private CollectionState collection;
        private CollectionsState subcollections;

        [TestFixtureSetUp]
        public void Initialize()
        {
            collection = new FamilySearchCollectionState(new Uri("https://sandbox.familysearch.org/platform/collections/sources"));
            collection.AuthenticateViaOAuth2Password(Resources.TestUserName, Resources.TestPassword, Resources.TestClientId);
            subcollections = (CollectionsState)collection.ReadSubcollections().Get();
        }

        [Test]
        public void TestReadAllSourcesOfAllUserDefinedCollectionsOfASpecificUser()
        {
            // Get the root collection
            var subcollection = subcollections.ReadCollection(subcollections.Entity.Collections.Single(x => string.IsNullOrEmpty(x.Title)));
            subcollection = (CollectionState)subcollection.Get();
            var state = subcollection.ReadSourceDescriptions();

            Assert.DoesNotThrow(() => subcollection.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.OK, subcollection.Response.StatusCode);
            Assert.IsNotNull(subcollection.Entity.Collections);
            Assert.Greater(subcollection.Entity.Collections.Count, 0);
        }

        [Test]
{'fraction_non_alphanumeric': 0.0947517730496454, 'fraction_numerical': 0.0011347517730496454, 'mean_word_length': 3.3423645320197046, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '5547407', 'n_tokens_mistral': 941, 'n_tokens_neox': 925, 'n_words': 178}