public void NuGetDeleteevaluatorReturnsCorrectValueForPackages(bool userHasPackages, bool expectedResult) { // Setup _packageService.Setup(ps => ps.FindPackagesByOwner(It.IsAny <User>(), It.IsAny <bool>(), It.IsAny <bool>())) .Returns(() => { if (userHasPackages) { return(new List <Package> { new Package() }); } return(new List <Package>()); }); var packageService = _packageService.Object; var accountDeleteTelemetryService = _accountDeleteTelemetryService.Object; var logger = _loggerFactory.CreateLogger <NuGetDeleteEvaluator>(); var testUser = new User() { EmailAddress = "*****@*****.**" }; testUser.Organizations = new List <Membership>(); var evaluator = new NuGetDeleteEvaluator(packageService, logger); // Act var result = evaluator.CanUserBeDeleted(testUser); // Assert Assert.Equal(expectedResult, result); }
public void NuGetDeleteevaluatorReturnsCorrectValueForUnconfirmed() { // Setup _packageService.Setup(ps => ps.FindPackagesByOwner(It.IsAny <User>(), It.IsAny <bool>(), It.IsAny <bool>())) .Returns(() => { return(new List <Package>()); }); var packageService = _packageService.Object; var accountDeleteTelemetryService = _accountDeleteTelemetryService.Object; var logger = _loggerFactory.CreateLogger <NuGetDeleteEvaluator>(); var testUser = new User(); testUser.Organizations = new List <Membership>(); var evaluator = new NuGetDeleteEvaluator(packageService, logger); // Act var result = evaluator.CanUserBeDeleted(testUser); // Assert Assert.True(result); }