-
Notifications
You must be signed in to change notification settings - Fork 870
Closed
Labels
dynamodbfeature-requestA feature should be added or improved.A feature should be added or improved.needs-major-versionCan only be considered for the next major releaseCan only be considered for the next major releasep1This is a high priority issueThis is a high priority issuequeuedv4
Description
I'm trying to write a unit test to validate the BatchWrite.Execute invocation, but I'm struggling with the mock of the CreateBatchWrite<T>
method because I'm not able to instantiate the BatchWrite<T>
class.
I'm using Moq to build the mocks, the code looks like:
this.dynamoDbMock
.Setup(m => m.CreateBatchWrite<SomeType>(It.IsAny<DynamoDBOperationConfig>()))
.Returns(Mock.Of<BatchWrite<SomeType>>());
But the Returns part is throwing an error because the BatchWrite class does not have a default constructor.
Possible Solution
I think is a good idea to define an interface for the BatchWrite class. In this way, the unit test will be easier to write.
public class BatchWrite<T> : BatchWrite, IBatchWriteOperations
sudoudaisuke, JTKAcies, elahurd925, jakubbujak, pmurraygenesis and 2 more
Metadata
Metadata
Assignees
Labels
dynamodbfeature-requestA feature should be added or improved.A feature should be added or improved.needs-major-versionCan only be considered for the next major releaseCan only be considered for the next major releasep1This is a high priority issueThis is a high priority issuequeuedv4