<commit_before>using Uno;
using Uno.Testing;

using Fuse.Charting;

using FuseTest;

namespace Fuse.Test
{
	public class FilterObservableTest: TestBase
	{
		[Test]
		public void Basic()
		{
			//just using a root since ObservableCollector is a behavior
			using (var root = new TestRootPanel())
			{
				var source = new ReadOnlyObservableList<string>();
				var alt  = new FilterAlternate{ Source = source };
				var calt = new FuseTest.ObservableCollector{ Items = alt };
				root.Children.Add(calt);
				root.IncrementFrame();
			
				Assert.AreEqual( "", calt.JoinValues() );
			
				source.Add( "0" );
				source.Add( "1" );
				source.Add( "2" );
				source.Add( "3" );
				root.PumpDeferred();
				Assert.AreEqual( "1,3", calt.JoinValues() );
				
				source.RemoveAt(1);
				root.PumpDeferred();
				Assert.AreEqual( "2", calt.JoinValues() );
			
				source.Add("4");
				root.PumpDeferred();
				Assert.AreEqual( "2,4", calt.JoinValues() );
				
				source.Insert(3,"5");
				root.PumpDeferred();
				Assert.AreEqual( "2,5", calt.JoinValues() );
				
				source.Replace(3,"6");
				root.PumpDeferred();
				Assert.AreEqual( "2,6", calt.JoinValues() );
				
				source.Clear();
				root.PumpDeferred();
				Assert.AreEqual( "", calt.JoinValues() );
			}
		}
		
		[Test]
		public void Random()
		{
			var r = new Random(123);
			using (var root = new TestRootPanel())
			{
				var source = new ReadOnlyObservableList<string>();
				var sa = source as IArray;
				var ends = new FilterEnd2{ Source = source };
				var calt = new FuseTest.ObservableCollector{ Items = ends };
				root.Children.Add(calt);
				root.IncrementFrame();
				
				source.Add( "X" );
				for (int i=0; i < 100; ++i)
				{
					source.Insert( r.NextInt(source.Count), "" + i );
					if (i % 3 == 0)
						source.RemoveAt( r.NextInt(source.Count) );
						
					var q = "";
					for (int j=2; j < sa.Length - 2; ++j)
					{
						if (j > 2)
							q += ",";
						q += sa[j];<commit_msg>Fuse.Charting: fix old deprecation warnings in test<commit_after>using Uno;
using Uno.Testing;

using Fuse.Charting;

using FuseTest;

namespace Fuse.Test
{
	public class FilterObservableTest: TestBase
	{
		[Test]
		public void Basic()
		{
			//just using a root since ObservableCollector is a behavior
			using (var root = new TestRootPanel())
			{
				var source = new ReadOnlyObservableList<string>();
				var alt  = new FilterAlternate{ Source = source };
				var calt = new FuseTest.ObservableCollector{ Items = alt };
				root.Children.Add(calt);
				root.IncrementFrame();
			
				Assert.AreEqual( "", calt.JoinValues() );
			
				source.Add( "0" );
				source.Add( "1" );
				source.Add( "2" );
				source.Add( "3" );
				root.PumpDeferred();
				Assert.AreEqual( "1,3", calt.JoinValues() );
				
				source.RemoveAt(1);
				root.PumpDeferred();
				Assert.AreEqual( "2", calt.JoinValues() );
			
				source.Add("4");
				root.PumpDeferred();
				Assert.AreEqual( "2,4", calt.JoinValues() );
				
				source.Insert(3,"5");
				root.PumpDeferred();
				Assert.AreEqual( "2,5", calt.JoinValues() );
				
				source.Replace(3,"6");
				root.PumpDeferred();
				Assert.AreEqual( "2,6", calt.JoinValues() );
				
				source.Clear();
				root.PumpDeferred();
				Assert.AreEqual( "", calt.JoinValues() );
			}
		}
		
		[Test]
		public void Random()
		{
			var r = new Random(123);
			using (var root = new TestRootPanel())
			{
				var source = new ReadOnlyObservableList<string>();
				var sa = source as IArray;
				var ends = new FilterEnd2{ Source = source };
				var calt = new FuseTest.ObservableCollector{ Items = ends };
				root.Children.Add(calt);
				root.IncrementFrame();
				
				source.Add( "X" );
				for (int i=0; i < 100; ++i)
				{
					source.Insert( r.Next(source.Count), "" + i );
					if (i % 3 == 0)
						source.RemoveAt( r.Next(source.Count) );
						
					var q = "";
					for (int j=2; j < sa.Length - 2; ++j)
					{
						if (j > 2)
							q += ",";
						q += sa[j];
{'fraction_non_alphanumeric': 0.15993945509586277, 'fraction_numerical': 0.016145307769929364, 'mean_word_length': 2.611111111111111, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '4224626', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1382, 'n_words': 317}