<commit_before>﻿using System;

using Kirkin.Refs;

using Xunit;

namespace Kirkin.Tests.Refs
{
    public class RefTests
    {
        [Fact]
        public void PropertyRef()
        {
            Dummy dummy = new Dummy { ID = 123 };
            IRef<int> id = Ref.FromExpression(() => dummy.ID);

            Assert.Equal(123, id.Value);

            id.Value = 321;

            Assert.Equal(321, dummy.ID);

            IRef weakID = id;

            Assert.Equal(321, weakID.Value);

            weakID.Value = 111;

            Assert.Equal(111, dummy.ID);
            Assert.ThrowsAny<Exception>(() => weakID.Value = "222");
        }

        sealed class Dummy
        {
            public int ID { get; set; }
            public string Value { get; set; }
        }
    }
}<commit_msg>RefTests: LocalRef<commit_after>﻿using System;

using Kirkin.Refs;

using Xunit;

namespace Kirkin.Tests.Refs
{
    public class RefTests
    {
        [Fact]
        public void PropertyRef()
        {
            Dummy dummy = new Dummy { ID = 123 };
            IRef<int> id = Ref.FromExpression(() => dummy.ID);

            Assert.Equal(123, id.Value);

            id.Value = 321;

            Assert.Equal(321, dummy.ID);

            IRef weakID = id;

            Assert.Equal(321, weakID.Value);

            weakID.Value = 111;

            Assert.Equal(111, dummy.ID);
            Assert.ThrowsAny<Exception>(() => weakID.Value = "222");
        }

        [Fact]
        public void LocalRef()
        {
            int value = 123;
            IRef<int> valueRef = Ref.FromExpression(() => value);

            Assert.Equal(123, valueRef.Value);

            valueRef.Value = 321;

            Assert.Equal(321, value);

            IRef weakID = valueRef;

            Assert.Equal(321, weakID.Value);

            weakID.Value = 111;

            Assert.Equal(111, value);
            Assert.ThrowsAny<Exception>(() => weakID.Value = "222");
        }

        sealed class Dummy
        {
            public int ID { get; set; }
            public string Value { get; set; }
        }
    }
}
{'fraction_non_alphanumeric': 0.1187648456057007, 'fraction_numerical': 0.0342042755344418, 'mean_word_length': 1.4834905660377358, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '908430', 'n_tokens_mistral': 689, 'n_tokens_neox': 608, 'n_words': 142}