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

Duplicate Tests in TestController.Test.cs #393

Closed
erin-allison opened this issue Feb 21, 2022 · 0 comments
Closed

Duplicate Tests in TestController.Test.cs #393

erin-allison opened this issue Feb 21, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@erin-allison
Copy link
Contributor

Since #292 was merged, there is no longer a difference between Created/Updated/NotModified, but TestController.Test.cs still have three cases for those which run the same exact code.

[Fact]
public async Task Test_If_Manager_Created_Is_Called()
{
_factory.Run();
var mock = _factory.Services.GetRequiredService<Mock<IManager>>();
mock.Reset();
mock.Setup(o => o.Reconciled(It.IsAny<V1TestEntity>()));
mock.Verify(o => o.Reconciled(It.IsAny<V1TestEntity>()), Times.Never);
await _factory.EnqueueEvent(ResourceEventType.Reconcile, new V1TestEntity());
mock.Verify(o => o.Reconciled(It.IsAny<V1TestEntity>()), Times.Once);
}
[Fact]
public async Task Test_If_Manager_Updated_Is_Called()
{
_factory.Run();
var mock = _factory.Services.GetRequiredService<Mock<IManager>>();
mock.Reset();
mock.Setup(o => o.Reconciled(It.IsAny<V1TestEntity>()));
mock.Verify(o => o.Reconciled(It.IsAny<V1TestEntity>()), Times.Never);
await _factory.EnqueueEvent(ResourceEventType.Reconcile, new V1TestEntity());
mock.Verify(o => o.Reconciled(It.IsAny<V1TestEntity>()), Times.Once);
}
[Fact]
public async Task Test_If_Manager_NotModified_Is_Called()
{
_factory.Run();
var mock = _factory.Services.GetRequiredService<Mock<IManager>>();
mock.Reset();
mock.Setup(o => o.Reconciled(It.IsAny<V1TestEntity>()));
mock.Verify(o => o.Reconciled(It.IsAny<V1TestEntity>()), Times.Never);
await _factory.EnqueueEvent(ResourceEventType.Reconcile, new V1TestEntity());
mock.Verify(o => o.Reconciled(It.IsAny<V1TestEntity>()), Times.Once);
}

Not a high priority thing, but there's not really much point keeping those lines around.

@erin-allison erin-allison added the bug Something isn't working label Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant