Some(including me) use the sut(system under test) to name the software being tested in unit tests.
Is this considered a good practice? why/why not?
Example:
[Test]
public void SetClaimUpdatedShouldCallSameMethodOnDependedServices()
{
//Arrange
var changedClaimService1 = new Mock<IChangedClaimsService>();
var changedClaimService2 = new Mock<IChangedClaimsService>();
var changedClaim = CreateAnyChangedClaim();
var sut = new ChangedClaimsServiceComposite(
changedClaimService1.Object,
changedClaimService2.Object);
//Act
sut.SetClaimUpdated(changedClaim);
//Assert
changedClaimService1.Verify(x => x.SetClaimUpdated(changedClaim), "changedClaimService1");
changedClaimService2.Verify(x => x.SetClaimUpdated(changedClaim), "changedClaimService2");
}
Aucun commentaire:
Enregistrer un commentaire