<commit_before>namespace Gu.Reactive.Tests.Conditions
{
    using System;

    using Gu.Reactive.Tests.Helpers;

    using NUnit.Framework;

    public class AbstractConditionTests
    {
        [Test]
        public void Naming()
        {
            var fake = new Fake { IsTrue = false };
            var condition = new ConditionExpandsAbstract(fake.ObservePropertyChanged(x => x.IsTrue)) { Name = "Name" };
            var negated = condition.Negate();
            Assert.AreEqual("Name", condition.Name);
            Assert.AreEqual("Not_Name", negated.Name);
        }

        private class ConditionExpandsAbstract : AbstractCondition
        {
            public ConditionExpandsAbstract(IObservable<object> observable)<commit_msg>Test AbstractCondition<commit_after>namespace Gu.Reactive.Tests.Conditions
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Reactive.Linq;

    using Gu.Reactive.Tests.Helpers;

    using NUnit.Framework;

    public class AbstractConditionTests
    {
        [Test]
        public void IsSatisfied()
        {
            var fake = new Fake { IsTrueOrNull = false };
            var condition = new FakeCondition(fake);
            Assert.AreEqual(false, condition.IsSatisfied);
            fake.IsTrueOrNull = true;
            Assert.AreEqual(true, condition.IsSatisfied);
        }

        [Test]
        public void Notifies()
        {
            var fake = new Fake { IsTrueOrNull = false };
            var condition = new FakeCondition(fake);
            var argses = new List<PropertyChangedEventArgs>();
            condition.PropertyChanged += (sender, args) => argses.Add(args);
            fake.IsTrueOrNull = true;
            Assert.AreEqual(1, argses.Count);
        }

        [Test]
        public void History()
        {
            var fake = new Fake { IsTrueOrNull = false };
            var condition = new FakeCondition(fake);
            fake.IsTrueOrNull = true;
            CollectionAssert.AreEqual(new bool?[] { null, true }, condition.History.Select(x => x.State));
        }

        [Test]
        public void Name()
        {
            var condition = new AbstractConditionImpl(Observable.Empty<object>()) { Name = "Name" };
            var negated = condition.Negate();
            Assert.AreEqual("Name", condition.Name);
            Assert.AreEqual("Not_Name", negated.Name);
        }

        private class FakeCondition : AbstractCondition
        {
            private readonly Fake fake;

            public FakeCondition(Fake fake)
                : base(fake.ObservePropertyChanged(x => x.IsTrueOrNull))
            {
                this.fake = fake;
            }

            protected override bool? Criteria()
            {
                return this.fake?.IsTrueOrNull;
            }
        }

        private class AbstractConditionImpl : AbstractCondition
        {
            public AbstractConditionImpl(IObservable<object> observable)
{'fraction_non_alphanumeric': 0.09166115155526142, 'fraction_numerical': 0.00033090668431502316, 'mean_word_length': 1.9521484375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3628037', 'n_tokens_mistral': 784, 'n_tokens_neox': 767, 'n_words': 174}