Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Common settings that generally should always be used with your language specific settings

# Auto detect text files and perform LF normalization
* text=auto

#
# The above will handle all files NOT found below
#

# Documents
*.bibtex text diff=bibtex
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text diff=markdown
*.mdx text diff=markdown
*.tex text diff=tex
*.adoc text
*.textile text
*.mustache text
*.csv text eol=crlf
*.tab text
*.tsv text
*.txt text
*.sql text
*.epub diff=astextplain

# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as text by default.
*.svg text
# If you want to treat it as binary,
# use the following line instead.
# *.svg binary
*.eps binary

# Scripts
*.bash text eol=lf
*.fish text eol=lf
*.sh text eol=lf
*.zsh text eol=lf
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# Serialisation
*.json text
*.toml text
*.xml text
*.yaml text
*.yml text

# Archives
*.7z binary
*.gz binary
*.tar binary
*.tgz binary
*.zip binary

# Text files where line endings should be preserved
*.patch -text

#
# Exclude files from exporting
#

.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
# Auto detect text files and perform LF normalization
* text=auto

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is duplicated with 4


*.cs text diff=csharp
*.cshtml text diff=html
*.csx text diff=csharp
*.sln text eol=crlf
*.csproj text eol=crlf

*.verified.txt text eol=lf working-tree-encoding=UTF-8
*.verified.xml text eol=lf working-tree-encoding=UTF-8
*.verified.json text eol=lf working-tree-encoding=UTF-8

# Apply override to all files in the directory
*.md linguist-detectable
# Basic .gitattributes for a PowerShell repo.

# Source files
# ============
*.ps1 text eol=crlf
*.ps1x text eol=crlf
*.psm1 text eol=crlf
*.psd1 text eol=crlf
*.ps1xml text eol=crlf
*.pssc text eol=crlf
*.psrc text eol=crlf
*.cdxml text eol=crlf
# Fix syntax highlighting on GitHub to allow comments
.vscode/*.json linguist-language=JSON-with-Comments
62 changes: 31 additions & 31 deletions Moq.Analyzers.sln
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34928.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.Analyzers", "Source\Moq.Analyzers\Moq.Analyzers.csproj", "{41ECC571-F586-460A-9BED-23528C8210C4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.Analyzers.Test", "Source\Moq.Analyzers.Test\Moq.Analyzers.Test.csproj", "{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{41ECC571-F586-460A-9BED-23528C8210C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41ECC571-F586-460A-9BED-23528C8210C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41ECC571-F586-460A-9BED-23528C8210C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41ECC571-F586-460A-9BED-23528C8210C4}.Release|Any CPU.Build.0 = Release|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8C917BC1-C0DE-4A46-BEE8-32FD66B447B1}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34928.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.Analyzers", "Source\Moq.Analyzers\Moq.Analyzers.csproj", "{41ECC571-F586-460A-9BED-23528C8210C4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.Analyzers.Test", "Source\Moq.Analyzers.Test\Moq.Analyzers.Test.csproj", "{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{41ECC571-F586-460A-9BED-23528C8210C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41ECC571-F586-460A-9BED-23528C8210C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41ECC571-F586-460A-9BED-23528C8210C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41ECC571-F586-460A-9BED-23528C8210C4}.Release|Any CPU.Build.0 = Release|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2348836-7129-4BE5-8AE6-D05FC8C28FC1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8C917BC1-C0DE-4A46-BEE8-32FD66B447B1}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Diagnostic 1
Id: Moq1300
Location: SourceFile(Test0.cs[1376..1391))
Location: SourceFile(Test0.cs[1423..1438))
Highlight: BaseSampleClass
Lines: mock.As<BaseSampleClass>();
Severity: Error
Message: Mock.As() should take interfaces only

Diagnostic 2
Id: Moq1300
Location: SourceFile(Test0.cs[1541..1551))
Location: SourceFile(Test0.cs[1594..1604))
Highlight: OtherClass
Lines: mock.As<OtherClass>();
Severity: Error
Expand Down
42 changes: 21 additions & 21 deletions Source/Moq.Analyzers.Test/AsAcceptOnlyInterfaceAnalyzerTests.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;
public class AsAcceptOnlyInterfaceAnalyzerTests : DiagnosticVerifier
{
[Fact]
public Task ShouldPassIfGoodParameters()
{
return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/AsAcceptOnlyInterface.cs")));
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new AsShouldBeUsedOnlyForInterfaceAnalyzer();
}
}
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;

public class AsAcceptOnlyInterfaceAnalyzerTests : DiagnosticVerifier
{
[Fact]
public Task ShouldPassIfGoodParameters()
{
return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/AsAcceptOnlyInterface.cs")));
}

protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new AsShouldBeUsedOnlyForInterfaceAnalyzer();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;
public class CallbackSignatureShouldMatchMockedMethodAnalyzerTests : DiagnosticVerifier
{
[Fact]
public Task ShouldPassIfGoodParameters()
{
return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/CallbackSignatureShouldMatchMockedMethod.cs")));
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new CallbackSignatureShouldMatchMockedMethodAnalyzer();
}
}
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;

public class CallbackSignatureShouldMatchMockedMethodAnalyzerTests : DiagnosticVerifier
{
[Fact]
public Task ShouldPassIfGoodParameters()
{
return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/CallbackSignatureShouldMatchMockedMethod.cs")));
}

protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new CallbackSignatureShouldMatchMockedMethodAnalyzer();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;
public class CallbackSignatureShouldMatchMockedMethodCodeFixTests : CodeFixVerifier
{
[Fact]
public Task ShouldSuggestQuickFixIfBadParameters()
{
return Verify(VerifyCSharpFix(File.ReadAllText("Data/CallbackSignatureShouldMatchMockedMethod.cs")));
}
protected override CodeFixProvider GetCSharpCodeFixProvider()
{
return new CallbackSignatureShouldMatchMockedMethodCodeFix();
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new CallbackSignatureShouldMatchMockedMethodAnalyzer();
}
}
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;

public class CallbackSignatureShouldMatchMockedMethodCodeFixTests : CodeFixVerifier
{
[Fact]
public Task ShouldSuggestQuickFixIfBadParameters()
{
return Verify(VerifyCSharpFix(File.ReadAllText("Data/CallbackSignatureShouldMatchMockedMethod.cs")));
}

protected override CodeFixProvider GetCSharpCodeFixProvider()
{
return new CallbackSignatureShouldMatchMockedMethodCodeFix();
}

protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new CallbackSignatureShouldMatchMockedMethodAnalyzer();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;
public class ConstructorArgumentsShouldMatchAnalyzerTests : DiagnosticVerifier
{
[Fact]
public Task ShouldFailIfClassParametersDoNotMatch()
{
return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/ConstructorArgumentsShouldMatch.cs")));
}
// [Fact]
// public Task ShouldPassIfCustomMockClassIsUsed()
// {
// return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/MockInterfaceWithParametersCustomMockFile.cs")));
// }
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new ConstructorArgumentsShouldMatchAnalyzer();
}
}
namespace Moq.Analyzers.Test
{
using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using TestHelper;
using Xunit;

public class ConstructorArgumentsShouldMatchAnalyzerTests : DiagnosticVerifier
{
[Fact]
public Task ShouldFailIfClassParametersDoNotMatch()
{
return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/ConstructorArgumentsShouldMatch.cs")));
}

// [Fact]
// public Task ShouldPassIfCustomMockClassIsUsed()
// {
// return Verify(VerifyCSharpDiagnostic(File.ReadAllText("Data/MockInterfaceWithParametersCustomMockFile.cs")));
// }

protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new ConstructorArgumentsShouldMatchAnalyzer();
}
}
}
Loading