<commit_before>﻿using System.Collections.Generic;
using CWiz.DomainDrivenDesign;
using Xunit;

namespace DomainDrivenDesignTests
{
    public class Person : ValueObject<Person>
    {
        public Person(string firstName, string lastName, int age, List<string> phoneNumbers)
        {
            FirstName = firstName;
            LastName = lastName;
            Age = age;
            PhoneNumbers = phoneNumbers;
        }

        public string FirstName { get; }
        public string LastName { get; }
        public int Age { get; }
        public List<string> PhoneNumbers { get; }
    }

    public class ValueObject_T_Spec
    {
        [Fact]
        public void Equal_should_return_true_for_two_different_instances_with_same_values()
        {
            var fname = "Xavier";
            var lname = "John";
            var age = 99;
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> { "123-456-7890", "234-567-8901" };
            var instance1 = new Person(fname, lname, age, phoneNumbers1);
            var instance2 = new Person(fname, lname, age, phoneNumbers2);
            Assert.Equal(instance1, instance2);
        }

        [Fact]
        public void NotEqual_should_return_true_when_values_are_different()
        {
            var phoneNumbers = new List<string> {"123-456-7890", "234-567-8901"};
            var instance1 = new Person("Xavier", "John", 99, phoneNumbers);
            var instance2 = new Person("Space", "Ghost", 99, phoneNumbers);
            Assert.NotEqual(instance1, instance2);
        }

        [Fact]
        public void X3DX3D_should_return_true_for_two_different_instances_with_same_value()
        {
            var fname = "Xavier";
            var lname = "John";
            var age = 99;
            var phoneNumbers1 = new List<string> { "123-456-7890", "234-567-8901" };
            var phoneNumbers2 = new List<string> { "123-456-7890", "234-567-8901" };
            var instance1 = new Person(fname, lname, age, phoneNumbers1);
            var instance2 = new Person(fname, lname, age, phoneNumbers2);
            Assert.True(instance1 == instance2);
        }

        [Fact]
        public void ne_should_return_true_when_values_are_different()
        {
            var phoneNumbers = new List<string> {"123-456-7890", "234-567-8901"};
            var instance1 = new Person("Xavier", "John", 99, phoneNumbers);
            var instance2 = new Person("Space", "Ghost", 99, phoneNumbers);
            Assert.True(instance1 != instance2);
        }


        [Fact]
        public void NotEqual_should_return_true_when_only_the_collections_are_different()
        {
            var fname = "Xavier";
            var lname = "John";
            var age = 99;
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> {"123-456-7890"};

            var instance1 = new Person(fname, lname, age, phoneNumbers1);
            var instance2 = new Person(fname, lname, age, phoneNumbers2);
            Assert.NotEqual(instance1, instance2);
        }

        [Fact]
        public void ne_should_return_true_when_only_the_collections_are_different()
        {
            var fname = "Xavier";
            var lname = "John";
            var age = 99;
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> {"123-456-7890"};

            var instance1 = new Person(fname, lname, age, phoneNumbers1);
            var instance2 = new Person(fname, lname, age, phoneNumbers2);
            Assert.True(instance1 != instance2);
        }
    }
}<commit_msg>Break up test to use ValueObjectWithoutCollection and ValueObjectWithCollection<commit_after>﻿using System.Collections.Generic;
using CWiz.DomainDrivenDesign;
using Xunit;

namespace DomainDrivenDesignTests
{
    public class ValueObject_T_Spec
    {
        [Fact]
        [Trait("Category", "ValueObjectWithoutCollection")]
        public void Equal_should_return_true_for_two_different_instances_with_same_values()
        {
            var fname = "Xavier";
            var lname = "John";
            var age = 99;
            var instance1 = new ValueObjectWithoutCollection(fname, lname, age);
            var instance2 = new ValueObjectWithoutCollection(fname, lname, age);
            Assert.Equal(instance1, instance2);
        }

        [Fact]
        [Trait("Category", "ValueObjectWithoutCollection")]
        public void X3DX3D_should_return_true_for_two_different_instances_with_same_value()
        {
            var fname = "Xavier";
            var lname = "John";
            var age = 99;
            var instance1 = new ValueObjectWithoutCollection(fname, lname, age);
            var instance2 = new ValueObjectWithoutCollection(fname, lname, age);
            Assert.True(instance1 == instance2);
        }

        [Fact]
        [Trait("Category", "ValueObjectWithoutCollection")]
        public void NotEqual_should_return_true_when_values_are_different()
        {
            var instance1 = new ValueObjectWithoutCollection("Xavier", "John", 99);
            var instance2 = new ValueObjectWithoutCollection("Space", "Ghost", 99);
            Assert.NotEqual(instance1, instance2);
        }

        [Fact]
        [Trait("Category", "ValueObjectWithoutCollection")]
        public void ne_should_return_true_when_values_are_different()
        {
            var instance1 = new ValueObjectWithoutCollection("Xavier", "John", 99);
            var instance2 = new ValueObjectWithoutCollection("Space", "Ghost", 99);
            Assert.True(instance1 != instance2);
        }


        // Collections
        [Fact]
        [Trait("Category", "ValueObjectWithCollection")]

        public void Equal_should_return_true_for_two_different_collection_instances_with_same_values()
        {
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> {"123-456-7890", "234-567-8901"};
            var instance1 = new ValueObjectWithCollection(phoneNumbers1);
            var instance2 = new ValueObjectWithCollection(phoneNumbers2);
            Assert.Equal(instance1, instance2);
        }

        [Fact]
        [Trait("Category", "ValueObjectWithCollection")]
        public void X3DX3D_should_return_true_for_two_different_collection_instances_with_same_value()
        {
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> {"123-456-7890", "234-567-8901"};
            var instance1 = new ValueObjectWithCollection(phoneNumbers1);
            var instance2 = new ValueObjectWithCollection(phoneNumbers2);
            Assert.True(instance1 == instance2);
        }

        [Fact]
        [Trait("Category", "ValueObjectWithCollection")]
        public void NotEqual_should_return_true_when_collections_are_different()
        {
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> {"123-456-7890"};
            var instance1 = new ValueObjectWithCollection(phoneNumbers1);
            var instance2 = new ValueObjectWithCollection(phoneNumbers2);
            Assert.NotEqual(instance1, instance2);
        }


        [Fact]
        [Trait("Category", "ValueObjectWithCollection")]
        public void ne_should_return_true_when_collections_are_different()
        {
            var phoneNumbers1 = new List<string> {"123-456-7890", "234-567-8901"};
            var phoneNumbers2 = new List<string> {"123-456-7890"};
            var instance1 = new ValueObjectWithCollection(phoneNumbers1);
            var instance2 = new ValueObjectWithCollection(phoneNumbers2);
            Assert.True(instance1 != instance2);
        }
    }

    public class ValueObjectWithoutCollection : ValueObject<ValueObjectWithoutCollection>
    {
        public ValueObjectWithoutCollection(string firstName, string lastName, int age)
        {
            FirstName = firstName;
            LastName = lastName;
            Age = age;
        }

        public string FirstName { get; }
        public string LastName { get; }
        public int Age { get; }
    }

    public class ValueObjectWithCollection : ValueObject<ValueObjectWithCollection>
    {
        public ValueObjectWithCollection(List<string> phoneNumbers)
        {
            PhoneNumbers = phoneNumbers;
        }

        public List<string> PhoneNumbers { get; }
    }
}
{'fraction_non_alphanumeric': 0.0983663538408064, 'fraction_numerical': 0.05121075194067895, 'mean_word_length': 2.3944160440424693, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, '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': '6714270', 'n_tokens_mistral': 2707, 'n_tokens_neox': 2380, 'n_words': 531}