コード例 #1
0
ファイル: VerifySettings.cs プロジェクト: khellang/Verify
        internal static Task RunOnVerifyMismatch(FilePair item, string?message)
        {
            if (handleOnVerifyMismatch == null)
            {
                return(Task.CompletedTask);
            }

            return(handleOnVerifyMismatch(item, message));
        }
コード例 #2
0
ファイル: VerifySettings.cs プロジェクト: khellang/Verify
        internal static Task RunOnFirstVerify(FilePair item)
        {
            if (handleOnFirstVerify == null)
            {
                return(Task.CompletedTask);
            }

            return(handleOnFirstVerify(item));
        }
コード例 #3
0
        static async Task <EqualityResult> GetResult(VerifySettings settings, FilePair filePair, Target target)
        {
            if (target.IsString)
            {
                var builder = new StringBuilder(target.StringData);
                ApplyScrubbers.Apply(target.Extension, builder, settings);
                return(await Comparer.Text(filePair, builder.ToString(), settings));
            }

            var stream = target.StreamData;

#if NETSTANDARD2_0 || NETFRAMEWORK
            using (stream)
#else
            await using (stream)
#endif
            {
                stream.MoveToStart();
                return(await Comparer.Streams(settings, stream, filePair));
            }
        }
コード例 #4
0
ファイル: InnerVerifier_Inner.cs プロジェクト: wtf3505/Verify
        static async Task <EqualityResult> GetResult(VerifySettings settings, FilePair filePair, ConversionStream conversionStream)
        {
            if (conversionStream.IsData)
            {
                var builder = new StringBuilder(conversionStream.Data);
                ApplyScrubbers.Apply(builder, settings.instanceScrubbers);
                return(await Comparer.Text(filePair, builder.ToString(), settings));
            }

            var stream = conversionStream.Stream;

#if NETSTANDARD2_0 || NETFRAMEWORK
            using (stream)
#else
            await using (stream)
#endif
            {
                stream.MoveToStart();
                return(await Comparer.Streams(settings, stream, filePair));
            }
        }
コード例 #5
0
        static async Task <EqualityResult> GetResult(VerifySettings settings, FilePair filePair, ConversionStream conversionStream)
        {
            var stream = conversionStream.Stream;

#if NETSTANDARD2_0 || NETFRAMEWORK
            using (stream)
#else
            await using (stream)
#endif
            {
                stream.MoveToStart();
                if (!EmptyFiles.Extensions.IsText(conversionStream.Extension))
                {
                    return(await Comparer.Streams(settings, stream, filePair));
                }

                var builder = await stream.ReadAsString();

                ApplyScrubbers.Apply(builder, settings.instanceScrubbers);
                return(await Comparer.Text(filePair, builder, settings));
            }
        }