Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MonoModder support multi mods patch same method #208

Open
wants to merge 5 commits into
base: reorganize
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Fix param order for Assert.Equal()
  • Loading branch information
MikiraSora committed Jan 3, 2025
commit 72b4a1abc0b7bad7df46e01a301c1bdd5ee68585
14 changes: 7 additions & 7 deletions src/MonoMod.UnitTest/MomoModPatch/MonoModPatchTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public MonoModPatchTest(ITestOutputHelper helper) : base(helper)
{
var resourcePath = Path.Combine(Path.GetDirectoryName(typeof(MonoModPatchTest).Assembly.Location),
"MomoModPatch", "Resources");

//ILSpy can view source code.
targetDllPath = Path.Combine(resourcePath, "DemoLib.dll");
aModDllPath = Path.Combine(resourcePath, "DemoLib.ModA.mm.dll");
Expand Down Expand Up @@ -73,10 +73,10 @@ public void OneModNormalTest()

//do asset
var ctorResult = type.GetProperty("CtorResult").GetValue(obj) as string;
Assert.Equal(ctorResult, "50A");
Assert.Equal("50A", ctorResult);

var calcResult = (int)type.GetMethod("Calculate").Invoke(obj, new object[] {1, 5});
Assert.Equal(calcResult, (1 + 5) * 10);
Assert.Equal((1 + 5) * 10, calcResult);
}

[Fact]
Expand All @@ -89,10 +89,10 @@ public void TwoModButNotCombineTest()

//do asset
var ctorResult = type.GetProperty("CtorResult").GetValue(obj) as string;
Assert.Contains(ctorResult, new[] {"50A", "B50"});
Assert.Contains(ctorResult, ["50A", "B50"]);

var calcResult = (int)type.GetMethod("Calculate").Invoke(obj, new object[] {1, 5});
Assert.Contains(calcResult, new[] {(1 + 5) * 10, 10000000 + 1 + 5});
Assert.Contains(calcResult, [(1 + 5) * 10, 10000000 + 1 + 5]);
}

[Fact]
Expand All @@ -105,10 +105,10 @@ public void TwoModButCombineTest()

//do asset
var ctorResult = type.GetProperty("CtorResult").GetValue(obj) as string;
Assert.Equal(ctorResult, "B50A");
Assert.Equal("B50A", ctorResult);

var calcResult = (int)type.GetMethod("Calculate").Invoke(obj, new object[] {1, 5});
Assert.Contains(calcResult, new[] {(1 + 5) * 10 + 1000000, (1000000 + 1 + 5) * 10});
Assert.Contains(calcResult, [(1 + 5) * 10 + 1000000, (1000000 + 1 + 5) * 10]);
}
}
}