<commit_before>﻿using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Linq;
using Xunit;
using MsTestToXunitConverter;

namespace MsTestToXunitConverter.xUnit
{
    public class ToFactTests
    {
        private MethodDeclarationSyntax GetTestMethod(string source)
        {
            var tree = CSharpSyntaxTree.ParseText(source, options: new CSharpParseOptions(kind: SourceCodeKind.Script));
            var root = tree.GetRoot() as CompilationUnitSyntax;

            return root.Members.OfType<MethodDeclarationSyntax>().First();
        }

        [Fact(DisplayName = "Converts TestMethod to fact")]
        public void ConvertTestMethod()
        {
            var method = GetTestMethod(@"[TestMethod]public void foo() {}");
            var actual = method.StripSurjectiveFactAttributes().ToString();

            var expected = GetTestMethod(@"[Fact]public void foo() {}").ToString();
            Assert.Equal(expected, actual);
        }

        [Fact(DisplayName = "Converts ignore to Skip")]
        public void ConvertTestMethodIgnore()
        {

        }

        [Fact(DisplayName = "Converts description to DisplayName")]
        public void ConvertTestMethodDescription()
        {

        }

        [Fact(DisplayName = "Converts all three attributes to one")]
        public void ConvertTestMethodIgnoreAndDescription()
        {

        }

        [Fact(DisplayName = "Ignores methods without target attributes")]
        public void ConvertPassesOverNormalMethods()
        {

        }
    }
}<commit_msg>Adding more testmethods for Fact<commit_after>﻿using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.Linq;
using Xunit;

namespace MsTestToXunitConverter.xUnit
{
    public class ToFactTests
    {
        private MethodDeclarationSyntax GetTestMethod(string source)
        {
            var tree = CSharpSyntaxTree.ParseText(source, options: new CSharpParseOptions(kind: SourceCodeKind.Script));
            var root = tree.GetRoot() as CompilationUnitSyntax;

            return root.Members.OfType<MethodDeclarationSyntax>().First();
        }

        [Fact(DisplayName = "Converts TestMethod to fact")]
        public void ConvertTestMethod()
        {
            var method = GetTestMethod(@"[TestMethod]public void Foo() {}");
            var actual = method.StripSurjectiveFactAttributes().ToString();

            var expected = GetTestMethod(@"[Fact]public void Foo() {}").ToString();
            Assert.Equal(expected, actual);
        }

        [Fact(DisplayName = "Converts ignore to Skip")]
        public void ConvertTestMethodIgnore()
        {
            var method = GetTestMethod(@"[Ignore(""reason"")]public void Foo() {}");
            var actual = method.StripSurjectiveFactAttributes().ToString();

            var expected = GetTestMethod(@"[Fact(Skip = ""reason"")]public void Foo() {}").ToString();
            Assert.Equal(expected, actual);

        }

        [Fact(DisplayName = "Converts description to DisplayName")]
        public void ConvertTestMethodDescription()
        {
            var method = GetTestMethod(@"[Description(""description"")]public void Foo() {}");
            var actual = method.StripSurjectiveFactAttributes().ToString();

            var expected = GetTestMethod(@"[Fact(DisplayName = ""description"")]public void Foo() {}").ToString();
            Assert.Equal(expected, actual);
        }

        [Fact(DisplayName = "Converts all three attributes to one")]
        public void ConvertTestMethodIgnoreAndDescription()
        {
            var method = GetTestMethod(@"[TestMethod][Skip(""reason"")][Description(""description"")]public void Foo() {}");
            var actual = method.StripSurjectiveFactAttributes().ToString();

            var expected = GetTestMethod(@"[Fact(DisplayName = ""description"", Skip = ""reason"")]public void Foo() {}").ToString();
            Assert.Equal(expected, actual);
        }

        [Fact(DisplayName = "Ignores methods without target attributes")]
        public void ConvertPassesOverNormalMethods()
        {
            const string testmethod = @"[RandomThing]public void Foo() {}";
            var method = GetTestMethod(testmethod);
            var actual = method.StripSurjectiveFactAttributes().ToString();

            var expected = GetTestMethod(testmethod).ToString();
            Assert.Equal(expected, actual);
        }
    }
}
{'fraction_non_alphanumeric': 0.113215859030837, 'fraction_numerical': 0.0, 'mean_word_length': 2.8581138487680544, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4218402', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1096, 'n_words': 262}