Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public async Task WhenApplicationInsightsAssemblyIsNotReferenced_NoGenerationOcc
{
TestCode = "",
ReferenceApplicationInsights = false
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -150,7 +150,7 @@ public async Task WhenApplicationInsightsAssemblyIsReferenced_ExtensionMethodIsG
GetSourceFile(ExpectedApplicationInsightsGeneratedFile, "AutoMockerApplicationInsightsExtensions.g.cs")
}
}
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -162,7 +162,7 @@ public async Task WhenGeneratorIsDisabled_NoGenerationOccurs()
TestCode = ""
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerApplicationInsightsGenerator", "false");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -182,11 +182,13 @@ public async Task WhenGeneratorIsExplicitlyEnabled_ExtensionMethodIsGenerated()
}
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerApplicationInsightsGenerator", "true");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

private static (string FileName, SourceText SourceText) GetSourceFile(string content, string fileName)
{
return (Path.Combine("Moq.AutoMocker.Generators", "Moq.AutoMocker.Generators.ApplicationInsightsExtensionSourceGenerator", fileName), SourceText.From(content, Encoding.UTF8));
}

public TestContext TestContext { get; set; }
}
10 changes: 6 additions & 4 deletions Moq.AutoMocker.Generators.Tests/FakeLoggingGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public async Task WhenFakeLoggingAssemblyIsNotReferenced_NoGenerationOccurs()
{
TestCode = "",
ReferenceFakeLogging = false
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -131,7 +131,7 @@ public async Task WhenFakeLoggingAssemblyIsReferenced_ExtensionMethodIsGenerated
GetSourceFile(ExpectedFakeLoggingGeneratedFile, "AutoMockerFakeLoggingExtensions.g.cs")
}
}
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -143,7 +143,7 @@ public async Task WhenGeneratorIsDisabled_NoGenerationOccurs()
TestCode = ""
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerFakeLoggingGenerator", "false");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -163,11 +163,13 @@ public async Task WhenGeneratorIsExplicitlyEnabled_ExtensionMethodIsGenerated()
}
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerFakeLoggingGenerator", "true");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

private static (string FileName, SourceText SourceText) GetSourceFile(string content, string fileName)
{
return (Path.Combine("Moq.AutoMocker.Generators", "Moq.AutoMocker.Generators.FakeLoggingExtensionSourceGenerator", fileName), SourceText.From(content, Encoding.UTF8));
}

public TestContext TestContext { get; set; }
}
12 changes: 7 additions & 5 deletions Moq.AutoMocker.Generators.Tests/GeneratorsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Generation_WithProjectThatDoesNotReferenceAutoMocker_ProducesD
{
expectedResult
}
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand Down Expand Up @@ -58,7 +58,7 @@ public class Controller { }
{
expectedResult
}
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand Down Expand Up @@ -90,7 +90,7 @@ public class Controller { }
{
expectedResult
}
}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand Down Expand Up @@ -150,7 +150,7 @@ public void ControllerConstructor_WithNullILoggerController_ThrowsArgumentNullEx
}
}

}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand Down Expand Up @@ -197,11 +197,13 @@ partial class ControllerTests
}
}

}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

private static (string FileName, SourceText SourceText) GetSourceFile(string content, string fileName)
{
return (Path.Combine("Moq.AutoMocker.Generators", "Moq.AutoMocker.Generators.UnitTestSourceGenerator", fileName), SourceText.From(content, Encoding.UTF8));
}

public TestContext TestContext { get; set; }
}
10 changes: 6 additions & 4 deletions Moq.AutoMocker.Generators.Tests/KeyedServicesGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public async Task WhenDependencyInjectionAssemblyIsNotReferenced_NoGenerationOcc
TestCode = "",
ReferenceDependencyInjection = false

}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -275,7 +275,7 @@ public async Task WhenDependencyInjectionAssemblyIsReferenced_ExtensionMethodIsG
}
}

}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -287,7 +287,7 @@ public async Task WhenGeneratorIsDisabled_NoGenerationOccurs()
TestCode = ""
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerKeyedServicesGenerator", "false");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -307,11 +307,13 @@ public async Task WhenGeneratorIsExplicitlyEnabled_ExtensionMethodIsGenerated()
}
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerKeyedServicesGenerator", "true");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

private static (string FileName, SourceText SourceText) GetSourceFile(string content, string fileName)
{
return (Path.Combine("Moq.AutoMocker.Generators", "Moq.AutoMocker.Generators.KeyedServicesExtensionSourceGenerator", fileName), SourceText.From(content, Encoding.UTF8));
}

public TestContext TestContext { get; set; }
}
10 changes: 6 additions & 4 deletions Moq.AutoMocker.Generators.Tests/OptionsGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task WhenOptionsAbstractionAssemblyIsNotReferenced_NoGenerationOccu
TestCode = "",
ReferenceOptionsAbstractions = false

}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -82,7 +82,7 @@ public async Task WhenOptionsAbstractionAssemblyIsReferenced_ExtensionMethodIsGe
}
}

}.RunAsync();
}.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -94,7 +94,7 @@ public async Task WhenGeneratorIsDisabled_NoGenerationOccurs()
TestCode = ""
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerOptionsGenerator", "false");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

[TestMethod]
Expand All @@ -114,11 +114,13 @@ public async Task WhenGeneratorIsExplicitlyEnabled_ExtensionMethodIsGenerated()
}
};
test.SetGlobalOption("build_property.EnableMoqAutoMockerOptionsGenerator", "true");
await test.RunAsync();
await test.RunAsync(TestContext.CancellationToken);
}

private static (string FileName, SourceText SourceText) GetSourceFile(string content, string fileName)
{
return (Path.Combine("Moq.AutoMocker.Generators", "Moq.AutoMocker.Generators.OptionsExtensionSourceGenerator", fileName), SourceText.From(content, Encoding.UTF8));
}

public TestContext TestContext { get; set; }
}
Loading
Loading