<commit_before>﻿using System;
using NUnit.Framework;
using FluentAssertions;

using ConsoleTwitter;
using System.Linq;

namespace ConsoleTwiterTests
{
    [TestFixture]
    public class UserRepositoryTests
    {
        [Test]
        public void GivenAnEmptyRepositoryWhenCreateIsCalledThenItCreatesANewUser()
        {
            var repository = new UserRepository();

            var bob = repository.Create("Bob");

            bob.UserHandle.Should().Be("Bob");
        }

        [Test]
        public void GivenARepositoryWithAliceAndBobWhenFindByIdentifierIsCalledUsingBobsHandleThenBobsUserIsReturned()
        {
            var repository = new UserRepository();

            repository.Create("Bob");

            var bob = repository.FindByIdentifier("Bob");

            bob.UserHandle.Should().Be("Bob");
        }

        [Test]
        public void GivenARepositoryWithBobAsUserWhenCreateIsCalledForBobThenItDoesNotCreateANewUser()
        {
            var repository = new UserRepository();

            repository.Create("Bob");

            repository.Create("Bob");

            repository.Users.Count().Should().Be(1);
        }
    }
}

<commit_msg>Code cleanup to remove repetition.<commit_after>﻿using System;
using NUnit.Framework;
using FluentAssertions;

using ConsoleTwitter;
using System.Linq;

namespace ConsoleTwiterTests
{
    [TestFixture]
    public class UserRepositoryTests
    {
        IRepository repository;
        User bob;

        [SetUp]
        public void Setup()
        {
            repository = new UserRepository();
            bob = repository.Create("Bob");
        }

        [Test]
        public void GivenAnEmptyRepositoryWhenCreateIsCalledThenItCreatesANewUser()
        {
            bob.UserHandle.Should().Be("Bob");
        }

        [Test]
        public void GivenARepositoryWithAliceAndBobWhenFindByIdentifierIsCalledUsingBobsHandleThenBobsUserIsReturned()
        {
            var user = repository.FindByIdentifier("Bob");

            user.UserHandle.Should().Be("Bob");
        }

        [Test]
        public void GivenARepositoryWithBobAsUserWhenCreateIsCalledForBobThenItDoesNotCreateANewUser()
        {
            repository.Create("Bob");

            ((UserRepository)repository).Users.Count().Should().Be(1);
        }
    }
}


{'fraction_non_alphanumeric': 0.09208819714656291, 'fraction_numerical': 0.0008646779074794639, 'mean_word_length': 2.4129793510324484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3819765', 'n_tokens_mistral': 637, 'n_tokens_neox': 603, 'n_words': 104}