<commit_before>﻿using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using SharpTools.IO.Utility;
using SharpTools.Extend.Time;

namespace Springs.Tests
{
    [TestClass]
    public class FileWatcherTests
    {
        private const string ASSETS_DIR = @"Assets\FileWatcher";
        private const string SAMPLE_IMG = "ImageA.tga";
        private static readonly string _baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

        private readonly FileWatcher _watcher;

        public FileWatcherTests()
        {
            _watcher = new FileWatcher();
        }

        [ClassCleanup]
        public static void Cleanup()
        {
            Directory.Delete(Path.Combine(_baseDirectory, ASSETS_DIR), recursive: true);
        }

        [TestMethod]
        [DeploymentItem(ASSETS_DIR, ASSETS_DIR)]
        public async Task WaitFor_ReturnsWhenFileIsReady()
        {
            var imageName = "ImageB.tga";
            var source = Path.Combine(_baseDirectory, ASSETS_DIR, SAMPLE_IMG);
            var target = Path.Combine(_baseDirectory, ASSETS_DIR, imageName);

            var watcherTask = _watcher.WaitFor(target, 10.Seconds());
            var moveTask = Task.Run(() =><commit_msg>Fix namespace for test class<commit_after>﻿using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using SharpTools.IO.Utility;
using SharpTools.Extend.Time;

namespace SharpTools.Test.IO.Utility
{
    [TestClass]
    public class FileWatcherTests
    {
        private const string ASSETS_DIR = @"Assets\FileWatcher";
        private const string SAMPLE_IMG = "ImageA.tga";
        private static readonly string _baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

        private readonly FileWatcher _watcher;

        public FileWatcherTests()
        {
            _watcher = new FileWatcher();
        }

        [TestMethod]
        [DeploymentItem(ASSETS_DIR, ASSETS_DIR)]
        public async Task WaitFor_ReturnsWhenFileIsReady()
        {
            var imageName = "ImageB.tga";
            var source = Path.Combine(_baseDirectory, ASSETS_DIR, SAMPLE_IMG);
            var target = Path.Combine(_baseDirectory, ASSETS_DIR, imageName);

            var watcherTask = _watcher.WaitFor(target, 10.Seconds());
            var moveTask = Task.Run(() =>
{'fraction_non_alphanumeric': 0.08613617719442165, 'fraction_numerical': 0.0016406890894175555, 'mean_word_length': 2.828885400313972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2273084', 'n_tokens_mistral': 713, 'n_tokens_neox': 680, 'n_words': 157}