<commit_before>﻿using MongoDB.Driver;
using Moq;
using Obsidian.Domain;
using Obsidian.Domain.Repositories;
using Obsidian.Persistence.Repositories;
using System;
using Xunit;

namespace Obsidian.Persistence.Test.Repositories
{
    public class UserMongoRepositoryTest : RepositoryTest<User>
    {
        protected override User CreateAggregateWithEmptyId() => new User();

        protected override IRepository<User> CreateRepository() => new UserMongoRepository(new Mock<IMongoDatabase>().Object);

        [Theory]
        [InlineData(null, "", "  ")]
        public async void FindByUserName_Fail_When_UserNameIsNullOrWhiteSpace(string value)
        {
            var repo = CreateRepository() as UserMongoRepository;
            await Assert.ThrowsAsync<ArgumentNullException>("userName", async () => await repo.FindByUserNameAsync(value));<commit_msg>fixed finde user by name test code<commit_after>﻿using MongoDB.Driver;
using Moq;
using Obsidian.Domain;
using Obsidian.Domain.Repositories;
using Obsidian.Persistence.Repositories;
using System;
using Xunit;

namespace Obsidian.Persistence.Test.Repositories
{
    public class UserMongoRepositoryTest : RepositoryTest<User>
    {
        protected override User CreateAggregateWithEmptyId() => new User();

        protected override IRepository<User> CreateRepository() => new UserMongoRepository(new Mock<IMongoDatabase>().Object);

        [Theory]
        [InlineData(null)]
        [InlineData("")]
        [InlineData("  ")]
        public async void FindByUserName_Fail_When_UserNameIsNullOrWhiteSpace(string value)
        {
            var repo = CreateRepository() as UserMongoRepository;
            await Assert.ThrowsAsync<ArgumentNullException>("userName", async () => await repo.FindByUserNameAsync(value));
{'fraction_non_alphanumeric': 0.09422321929332586, 'fraction_numerical': 0.0, 'mean_word_length': 4.293768545994065, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, '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': '2894025', 'n_tokens_mistral': 499, 'n_tokens_neox': 486, 'n_words': 107}