-
-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
I'm trying to mock AWS' interfaces for S3 and SimpleSystemsManagement:
var mock = Mock.Of<IAmazonSimpleSystemsManagement>();Expected Behavior
I expect this to compile and have a working mock
Actual Behavior
Compilation fails:
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(6,68): Error CS0535 : 'Amazon_Runtime_IAmazonService_MockImpl' does not implement interface member 'IAmazonService.CreateDefaultClientConfig()'
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(6,68): Error CS0535 : 'Amazon_Runtime_IAmazonService_MockImpl' does not implement interface member 'IAmazonService.CreateDefaultServiceClient(AWSCredentials, ClientConfig)'
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(8,96): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(10,127): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>Amazon_Runtime_IAmazonService_MockMembers.g.cs(8,83): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>Amazon_Runtime_IAmazonService_MockFactory.g.cs(14,88): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>------- Finished building project: Company.Business.Pdf.Tests. Succeeded: False. Errors: 6. Warnings: 0
Steps to Reproduce
I suspect the source generators aren't capable of handling static members.
This is the offending line in AWS' interface:
public interface IAmazonService
{
/// <summary>
/// A readonly view of the configuration for the service client.
/// </summary>
IClientConfig Config
{
get;
}
#if NET8_0_OR_GREATER
/// <summary>
/// Factory method for creating the service client config object used by the service client.
/// This method is intended to be used by AWSSDK.Extensions.NETCore.Setup for creating
/// AWS service clients registered in the dependency injection container.
/// </summary>
/// <returns></returns>
static abstract ClientConfig CreateDefaultClientConfig();
}TUnit Version
TUnit -> 1.18.9 TUnit.Mocks -> 1.18.9-beta
.NET Version
NET 10.0
Operating System
Windows
IDE / Test Runner
dotnet CLI (dotnet test / dotnet run)
Error Output / Stack Trace
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(6,68): Error CS0535 : 'Amazon_Runtime_IAmazonService_MockImpl' does not implement interface member 'IAmazonService.CreateDefaultClientConfig()'
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(6,68): Error CS0535 : 'Amazon_Runtime_IAmazonService_MockImpl' does not implement interface member 'IAmazonService.CreateDefaultServiceClient(AWSCredentials, ClientConfig)'
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(8,96): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>Amazon_Runtime_IAmazonService_MockImpl.g.cs(10,127): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>Amazon_Runtime_IAmazonService_MockMembers.g.cs(8,83): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>Amazon_Runtime_IAmazonService_MockFactory.g.cs(14,88): Error CS8920 : The interface 'IAmazonService' cannot be used as type argument. Static member 'IAmazonService.CreateDefaultClientConfig()' does not have a most specific implementation in the interface.
8>------- Finished building project: Company.Business.Pdf.Tests. Succeeded: False. Errors: 6. Warnings: 0Additional Context
This happens with all Amazon interfaces because they all inherit from IAmazonService which has static members
IDE-Specific Issue?
- I've confirmed this issue occurs when running via
dotnet testordotnet run, not just in my IDE
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working