Skip to content

Commit

Permalink
More generic tests (#14)
Browse files Browse the repository at this point in the history
* add coverage to new test

* add property tests

* change arg.any to method instead of prop

* generic classes working

* generic classes working and fixed indexers

* remove unused code

* update test coverage process

* no need to restore (I think?)

* add props

* switch up the order

* clean up buildAndTest yaml

* switch up NumTimes

* add throws functionality

* add interface overload tests

* fix tests slnf

* add support for internal interface calls

* fix tests

* add nuget icon

* fix warnings

* exclude dummy class from code cov

* add more generic tests

* Merge remote-tracking branch 'origin/main' into dev

* fix errors

* add tests for virtual members
  • Loading branch information
connorivy authored Nov 27, 2024
1 parent 3d3fab0 commit 997f29f
Show file tree
Hide file tree
Showing 12 changed files with 692 additions and 23 deletions.
10 changes: 9 additions & 1 deletion MockMe.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wiki", "wiki", "{4723EF4B-98A5-4F3D-BEB9-0632A3939D4D}"
ProjectSection(SolutionItems) = preProject
wiki\AvoidingCommonPitfalls.md = wiki\AvoidingCommonPitfalls.md
HowDoesItWork.md = HowDoesItWork.md
wiki\HowDoesItWork.md = wiki\HowDoesItWork.md
wiki\QuickStart.md = wiki\QuickStart.md
EndProjectSection
EndProject
Expand All @@ -48,6 +48,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockMe.Tests.Overloads.Seal
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockMe.Tests.Overloads.Interface", "tests\MockMe.Tests.Overloads.Interface\MockMe.Tests.Overloads.Interface.csproj", "{E08ADBB1-7CB8-4BFF-9BAC-485DC7822719}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MockMe.Tests.Overloads.Virtual", "tests\MockMe.Tests.Overloads.Virtual\MockMe.Tests.Overloads.Virtual.csproj", "{2F9424F6-0BB5-4BD8-92A7-3625A666111F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -86,6 +88,10 @@ Global
{E08ADBB1-7CB8-4BFF-9BAC-485DC7822719}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E08ADBB1-7CB8-4BFF-9BAC-485DC7822719}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E08ADBB1-7CB8-4BFF-9BAC-485DC7822719}.Release|Any CPU.Build.0 = Release|Any CPU
{2F9424F6-0BB5-4BD8-92A7-3625A666111F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F9424F6-0BB5-4BD8-92A7-3625A666111F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F9424F6-0BB5-4BD8-92A7-3625A666111F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F9424F6-0BB5-4BD8-92A7-3625A666111F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -100,12 +106,14 @@ Global
{705ED000-6380-4C9E-BF2E-71BA8C390E28} = {134D18E2-ECAC-4571-B7BE-0C10796D5555}
{1CDE1684-1F3F-AF84-5126-85482E225FD8} = {134D18E2-ECAC-4571-B7BE-0C10796D5555}
{E08ADBB1-7CB8-4BFF-9BAC-485DC7822719} = {134D18E2-ECAC-4571-B7BE-0C10796D5555}
{2F9424F6-0BB5-4BD8-92A7-3625A666111F} = {134D18E2-ECAC-4571-B7BE-0C10796D5555}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CF07A0CA-1140-44DC-9E7E-F99E65D9EF97}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
tests\MockMe.Tests.Overloads\MockMe.Tests.Overloads.projitems*{1cde1684-1f3f-af84-5126-85482e225fd8}*SharedItemsImports = 5
tests\MockMe.Tests.Overloads\MockMe.Tests.Overloads.projitems*{2f9424f6-0bb5-4bd8-92a7-3625a666111f}*SharedItemsImports = 5
tests\MockMe.Tests.Overloads\MockMe.Tests.Overloads.projitems*{705ed000-6380-4c9e-bf2e-71ba8c390e28}*SharedItemsImports = 13
tests\MockMe.Tests.Overloads\MockMe.Tests.Overloads.projitems*{e08adbb1-7cb8-4bff-9bac-485dc7822719}*SharedItemsImports = 5
EndGlobalSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ string typeSymbolName
)
.GetValue(mock);
return ({returnType})
{(isVoidReturnType ? "" : $"return ({returnType})")}
callTracker
.GetType()
.GetMethod(
Expand All @@ -84,7 +84,7 @@ string typeSymbolName
{string.Join(", ", this.MethodSymbol.TypeParameters.Select(p => p.Name.AddOnIfNotEmpty("typeof(", ")"))) .AddOnIfNotEmpty(".MakeGenericMethod(", ")")}
.Invoke(callTracker, new object[] {{ {paramString} }});
}}
return default;
return{(isVoidReturnType ? "" : " default")};
}}
"
);
Expand Down
Binary file modified src/MockMe/Images/MockMeM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions tests/MockMe.Tests.ExampleClasses/ClassWithGenericMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace MockMe.Tests.ExampleClasses;

public class ClassWithGenericMethods
{
public T OneGenericType<T>(T t) => throw new NotImplementedException();

public T1 TwoGenericTypes<T1, T2>(T1 t, T2 t2) => throw new NotImplementedException();

public T1 ThreeGenericTypes<T1, T2, T3>(T1 t, T2 t2, T3 t3) =>
throw new NotImplementedException();
}
Loading

0 comments on commit 997f29f

Please sign in to comment.