<commit_before>using NUnit.Framework;

namespace NSubstitute.Acceptance.Specs
{
    public class OutAndRefParameters
    {
        public interface ILookupStrings
        {
            bool TryRef(ref int number);
            bool TryGet(string key, out string value);
            string Get(string key);
            string LookupByObject(ref object obj);
        }

        [Test]
        [Pending]
        public void SetNonOutputArgument()
        {
            var sub = Substitute.For<ILookupStrings>();
            var key = "hi";
            sub.Get(key).Returns("hello");
            sub.When(x => x.Get(key)).Do(x => { x[0] = "snarf!"; });

            var result = sub.Get("hi");

            Assert.That(key, Is.EqualTo("hi"));
            Assert.That(result, Is.EqualTo("hello"));
        }

        [Test]
        [Pending]
        public void SetOutputArgument()
        {
            var sub = Substitute.For<ILookupStrings>();
            string value;
            sub.TryGet("hi", out value).Returns(x => { x[1] = "hello"; return true; });

            var result = sub.TryGet("hi", out value);

            Assert.That(value, Is.EqualTo("hello"));
            Assert.That(result, Is.True);
        }

        [Test]
        public void MatchIntRefArgument()
        {
            var sub = Substitute.For<ILookupStrings>();
            var value = 1;
            var otherValue = 1;
            sub.TryRef(ref value);
            sub.DidNotReceive().TryRef(ref otherValue);
        }

        [Test]
        public void MatchObjectRefArgument()
        {
            var sub = Substitute.For<ILookupStrings>();
            var value = new object();
            var otherValue = new object();
            sub.LookupByObject(ref value);
            sub.DidNotReceive().LookupByObject(ref otherValue);
        }
    }
}<commit_msg>Working on ArgumentSpecifications in prep for Out and Ref param support<commit_after>using NUnit.Framework;

namespace NSubstitute.Acceptance.Specs
{
    public class OutAndRefParameters
    {
        public interface ILookupStrings
        {
            bool TryGet(string key, out string value);
            string Get(string key);
            string LookupByObject(ref object obj);
        }

        [Test]
        [Pending]
        public void SetOutputArgument()
        {
            var sub = Substitute.For<ILookupStrings>();
            string value;
            //sub.TryGet("hi", out value).Returns(x => { x[1] = "hello"; return true; });

            var result = sub.TryGet("hi", out value);

            Assert.That(value, Is.EqualTo("hello"));
            Assert.That(result, Is.True);
        }

        [Test]
        [Pending]
        public void Match_and_set_ref_argument()
        {
            var sub = Substitute.For<ILookupStrings>();
            var key = new object();
            sub.LookupByObject(ref key).Returns(x => { x[0] = new object(); return "1"; });

            Assert.That(sub.LookupByObject(ref key), Is.EqualTo("1"));
            Assert.That(sub.LookupByObject(ref key), Is.EqualTo("1"));
        }

        [Test]
        public void Match_int_ref_argument()
        {
            var sub = Substitute.For<ILookupStrings>();
            var value = 1;
            var otherValue = 1;
            sub.TryRef(ref value);
            sub.DidNotReceive().TryRef(ref otherValue);
        }

        [Test]
        public void Match_object_ref_argument()
        {
            var sub = Substitute.For<ILookupStrings>();
            var value = new object();
            var otherValue = new object();
            sub.LookupByObject(ref value);
            sub.DidNotReceive().LookupByObject(ref otherValue);
        }
    }
}
{'fraction_non_alphanumeric': 0.11752021563342319, 'fraction_numerical': 0.0029649595687331535, 'mean_word_length': 1.7570579494799405, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 16, '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': '1887011', 'n_tokens_mistral': 1034, 'n_tokens_neox': 1009, 'n_words': 232}