Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix formatting of typeof operator and class initialization line break.

  • Loading branch information...
commit 58fa087700fb8fdbcd41fd1a5b8f5bbd6ba45d97 1 parent 53f6b87
drakomeep drakomeep authored jeffhandley committed
Showing with 720 additions and 720 deletions.
  1. +1 −1  Facts/Commands/AutomaticallyCuratePackageCommandFacts.cs
  2. +2 −2 Facts/Commands/CreatedCuratedPackageCommandFacts.cs
  3. +1 −1  Facts/Commands/DeleteCuratedPackageCommandFacts.cs
  4. +1 −1  Facts/Commands/ModifyCuratedPackageCommandFacts.cs
  5. +22 −22 Facts/Controllers/ApiControllerFacts.cs
  6. +2 −2 Facts/Controllers/CuratedFeedsControllerFacts.cs
  7. +28 −28 Facts/Controllers/CuratedPackagesControllerFacts.cs
  8. +49 −49 Facts/Controllers/PackagesControllerFacts.cs
  9. +44 −44 Facts/Controllers/UsersControllerFacts.cs
  10. +9 −9 Facts/PackageCurators/WebMatrixPackageCuratorFacts.cs
  11. +9 −9 Facts/PackageCurators/Windows8PackageCuratorFacts.cs
  12. +4 −4 Facts/Services/CloudBlobFileStorageServiceFacts.cs
  13. +16 −16 Facts/Services/MessageServiceFacts.cs
  14. +5 −5 Facts/Services/NuGetExeDownloaderServiceFacts.cs
  15. +101 −101 Facts/Services/PackageServiceFacts.cs
  16. +60 −60 Facts/Services/UsersServiceFacts.cs
  17. +17 −17 Facts/ViewModels/DisplayPackageViewModelFacts.cs
  18. +14 −14 Website/App_Start/AppActivator.cs
  19. +2 −2 Website/App_Start/AuthenticationModule.cs
  20. +1 −1  Website/App_Start/Configuration.cs
  21. +10 −10 Website/App_Start/ContainerBindings.cs
  22. +5 −5 Website/App_Start/Routes.cs
  23. +6 −6 Website/Commands/CreateCuratedPackageCommand.cs
  24. +5 −5 Website/Controllers/JsonApiController.cs
  25. +18 −18 Website/Controllers/PackagesController.cs
  26. +23 −23 Website/Controllers/UsersController.cs
  27. +1 −1  Website/DataServices/CountInterceptor.cs
  28. +1 −1  Website/DataServices/DisregardODataInterceptor.cs
  29. +11 −11 Website/DataServices/FeedServiceBase.cs
  30. +1 −1  Website/DataServices/ODataRemoveVersionSorter.cs
  31. +62 −62 Website/DataServices/PackageExtensions.cs
  32. +6 −6 Website/DataServices/V1Feed.svc.cs
  33. +3 −3 Website/DataServices/V2CuratedFeed.svc.cs
  34. +5 −5 Website/DataServices/V2Feed.svc.cs
  35. +1 −1  Website/DynamicData/FieldTemplates/DateTime_Edit.ascx.cs
  36. +1 −1  Website/DynamicData/Filters/Boolean.ascx.cs
  37. +1 −1  Website/ExtensionMethods.cs
  38. +82 −82 Website/Migrations/201110060711357_Initial.cs
  39. +15 −15 Website/Migrations/201110180052097_GallerySettings.cs
  40. +8 −8 Website/Migrations/201110230649210_PackageOwnerRequests.cs
  41. +14 −14 Website/Migrations/201203180016174_CuratedFeeds.cs
  42. +5 −5 Website/Migrations/201205172325056_FrameworkName.cs
  43. +1 −1  Website/Migrations/201206250141447_ExecuteELMAHSql.cs
  44. +1 −1  Website/Migrations/SqlResourceMigration.cs
  45. +5 −5 Website/Services/AggregateStatsService.cs
  46. +8 −8 Website/Services/Extensions.cs
  47. +26 −26 Website/Services/PackageService.cs
  48. +7 −7 Website/Services/UserService.cs
2  Facts/Commands/AutomaticallyCuratePackageCommandFacts.cs
View
@@ -21,7 +21,7 @@ public TestableAutomaticallyCuratePackageCommand()
protected override IEnumerable<T> GetServices<T>()
{
- if (typeof (T) == typeof (IAutomaticPackageCurator))
+ if (typeof(T) == typeof(IAutomaticPackageCurator))
{
return StubCurators.Select(stub => (T)stub.Object);
}
4 Facts/Commands/CreatedCuratedPackageCommandFacts.cs
View
@@ -36,12 +36,12 @@ public TestableCreateCuratedPackageCommand()
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICuratedFeedByKeyQuery))
+ if (typeof(T) == typeof(ICuratedFeedByKeyQuery))
{
return (T)StubCuratedFeedByKeyQry.Object;
}
- if (typeof (T) == typeof (IPackageRegistrationByKeyQuery))
+ if (typeof(T) == typeof(IPackageRegistrationByKeyQuery))
{
return (T)StubPackageRegistrationByKeyQry.Object;
}
2  Facts/Commands/DeleteCuratedPackageCommandFacts.cs
View
@@ -34,7 +34,7 @@ public TestableDeleteCuratedPackageCommand()
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICuratedFeedByKeyQuery))
+ if (typeof(T) == typeof(ICuratedFeedByKeyQuery))
{
return (T)StubCuratedFeedByKeyQry.Object;
}
2  Facts/Commands/ModifyCuratedPackageCommandFacts.cs
View
@@ -28,7 +28,7 @@ public TestableModifyCuratedPackageCommand()
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICuratedFeedByKeyQuery))
+ if (typeof(T) == typeof(ICuratedFeedByKeyQuery))
{
return (T)StubCuratedFeedByKeyQry.Object;
}
44 Facts/Controllers/ApiControllerFacts.cs
View
@@ -87,10 +87,10 @@ public void WillReturnConflictIfAPackageWithTheIdAndSemanticVersionAlreadyExists
var user = new User();
var packageRegistration = new PackageRegistration
- {
- Packages = new List<Package> { new Package { Version = version.ToString() } },
- Owners = new List<User> { user }
- };
+ {
+ Packages = new List<Package> { new Package { Version = version.ToString() } },
+ Owners = new List<User> { user }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageRegistrationById(It.IsAny<string>())).Returns(packageRegistration);
@@ -262,9 +262,9 @@ public void WillFindTheUserThatMatchesTheApiKey()
{
var owner = new User { Key = 1 };
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
- };
+ {
+ PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(package);
var userSvc = new Mock<IUserService>();
@@ -282,9 +282,9 @@ public void WillNotDeleteThePackageIfApiKeyDoesNotBelongToAnOwner()
{
var owner = new User { Key = 1 };
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Owners = new[] { new User() } }
- };
+ {
+ PackageRegistration = new PackageRegistration { Owners = new[] { new User() } }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(package);
packageSvc.Setup(svc => svc.MarkPackageUnlisted(It.IsAny<Package>())).Throws(
@@ -306,9 +306,9 @@ public void WillUnlistThePackageIfApiKeyBelongsToAnOwner()
{
var owner = new User { Key = 1 };
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
- };
+ {
+ PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(package);
var userSvc = new Mock<IUserService>();
@@ -492,9 +492,9 @@ public void WillFindTheUserThatMatchesTheApiKey()
{
var owner = new User { Key = 1 };
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
- };
+ {
+ PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(package);
var userSvc = new Mock<IUserService>();
@@ -512,9 +512,9 @@ public void WillNotListThePackageIfApiKeyDoesNotBelongToAnOwner()
{
var owner = new User { Key = 1 };
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Owners = new[] { new User() } }
- };
+ {
+ PackageRegistration = new PackageRegistration { Owners = new[] { new User() } }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(package);
packageSvc.Setup(svc => svc.MarkPackageListed(It.IsAny<Package>())).Throws(
@@ -536,9 +536,9 @@ public void WillListThePackageIfApiKeyBelongsToAnOwner()
{
var owner = new User { Key = 1 };
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
- };
+ {
+ PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(package);
var userSvc = new Mock<IUserService>();
4 Facts/Controllers/CuratedFeedsControllerFacts.cs
View
@@ -15,7 +15,7 @@ public class TestableCuratedFeedsController : CuratedFeedsController
public TestableCuratedFeedsController()
{
StubCuratedFeed = new CuratedFeed
- { Key = 0, Name = "aName", Managers = new HashSet<User>(new[] { new User { Username = "aUsername" } }) };
+ { Key = 0, Name = "aName", Managers = new HashSet<User>(new[] { new User { Username = "aUsername" } }) };
StubCuratedFeedByNameQry = new Mock<ICuratedFeedByNameQuery>();
StubIdentity = new Mock<IIdentity>();
@@ -37,7 +37,7 @@ protected override IIdentity Identity
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICuratedFeedByNameQuery))
+ if (typeof(T) == typeof(ICuratedFeedByNameQuery))
{
return (T)StubCuratedFeedByNameQry.Object;
}
56 Facts/Controllers/CuratedPackagesControllerFacts.cs
View
@@ -15,7 +15,7 @@ protected TestableCuratedPackagesControllerBase()
{
StubCreatedCuratedPackageCmd = new Mock<ICreateCuratedPackageCommand>();
StubCuratedFeed = new CuratedFeed
- { Key = 0, Name = "aName", Managers = new HashSet<User>(new[] { new User { Username = "aUsername" } }) };
+ { Key = 0, Name = "aName", Managers = new HashSet<User>(new[] { new User { Username = "aUsername" } }) };
StubCuratedFeedByNameQry = new Mock<ICuratedFeedByNameQuery>();
StubDeleteCuratedPackageCmd = new Mock<IDeleteCuratedPackageCommand>();
StubIdentity = new Mock<IIdentity>();
@@ -43,27 +43,27 @@ protected override IIdentity Identity
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICreateCuratedPackageCommand))
+ if (typeof(T) == typeof(ICreateCuratedPackageCommand))
{
return (T)StubCreatedCuratedPackageCmd.Object;
}
- if (typeof (T) == typeof (ICuratedFeedByNameQuery))
+ if (typeof(T) == typeof(ICuratedFeedByNameQuery))
{
return (T)StubCuratedFeedByNameQry.Object;
}
- if (typeof (T) == typeof (IDeleteCuratedPackageCommand))
+ if (typeof(T) == typeof(IDeleteCuratedPackageCommand))
{
return (T)StubDeleteCuratedPackageCmd.Object;
}
- if (typeof (T) == typeof (IModifyCuratedPackageCommand))
+ if (typeof(T) == typeof(IModifyCuratedPackageCommand))
{
return (T)StubModifyCuratedPackageCmd.Object;
}
- if (typeof (T) == typeof (IPackageRegistrationByIdQuery))
+ if (typeof(T) == typeof(IPackageRegistrationByIdQuery))
{
return (T)StubPackageRegistrationByIdQry.Object;
}
@@ -114,13 +114,13 @@ public void WillDeleteTheCuratedPackageWhenRequestIsValid()
var controller = new TestableCuratedPackagesController();
controller.StubCuratedFeed.Key = 42;
controller.StubCuratedFeed.Packages = new[]
- {
- new CuratedPackage
- {
- Key = 1066,
- PackageRegistration = new PackageRegistration { Id = "theCuratedPackageId" }
- }
- };
+ {
+ new CuratedPackage
+ {
+ Key = 1066,
+ PackageRegistration = new PackageRegistration { Id = "theCuratedPackageId" }
+ }
+ };
controller.DeleteCuratedPackage("theCuratedFeedName", "theCuratedPackageId");
@@ -147,10 +147,10 @@ public TestableCuratedPackagesController()
{
StubCuratedFeed.Managers = new[] { new User { Username = "aUsername" } };
StubCuratedFeed.Packages = new[]
- {
- new CuratedPackage
- { PackageRegistration = new PackageRegistration { Id = "aCuratedPackageId" } }
- };
+ {
+ new CuratedPackage
+ { PackageRegistration = new PackageRegistration { Id = "aCuratedPackageId" } }
+ };
StubCuratedFeedByNameQry
.Setup(stub => stub.Execute(It.IsAny<string>(), It.IsAny<bool>()))
.Returns(StubCuratedFeed);
@@ -262,13 +262,13 @@ public void WillModifyTheCuratedPackageWhenRequestIsValid()
var controller = new TestableCuratedPackagesController();
controller.StubCuratedFeed.Key = 42;
controller.StubCuratedFeed.Packages = new[]
- {
- new CuratedPackage
- {
- Key = 1066,
- PackageRegistration = new PackageRegistration { Id = "theCuratedPackageId" }
- }
- };
+ {
+ new CuratedPackage
+ {
+ Key = 1066,
+ PackageRegistration = new PackageRegistration { Id = "theCuratedPackageId" }
+ }
+ };
controller.PatchCuratedPackage("theCuratedFeedName", "theCuratedPackageId", new ModifyCuratedPackageRequest { Included = true });
@@ -297,10 +297,10 @@ public TestableCuratedPackagesController()
{
StubCuratedFeed.Managers = new[] { new User { Username = "aUsername" } };
StubCuratedFeed.Packages = new[]
- {
- new CuratedPackage
- { PackageRegistration = new PackageRegistration { Id = "aCuratedPackageId" } }
- };
+ {
+ new CuratedPackage
+ { PackageRegistration = new PackageRegistration { Id = "aCuratedPackageId" } }
+ };
StubCuratedFeedByNameQry
.Setup(stub => stub.Execute(It.IsAny<string>(), It.IsAny<bool>()))
.Returns(StubCuratedFeed);
98 Facts/Controllers/PackagesControllerFacts.cs
View
@@ -212,15 +212,15 @@ public class TheContactOwnersMethod
public void OnlyShowsOwnersWhoAllowReceivingEmails()
{
var package = new PackageRegistration
- {
- Id = "pkgid",
- Owners = new[]
- {
- new User { Username = "helpful", EmailAllowed = true },
- new User { Username = "grinch", EmailAllowed = false },
- new User { Username = "helpful2", EmailAllowed = true }
- }
- };
+ {
+ Id = "pkgid",
+ Owners = new[]
+ {
+ new User { Username = "helpful", EmailAllowed = true },
+ new User { Username = "grinch", EmailAllowed = false },
+ new User { Username = "helpful2", EmailAllowed = true }
+ }
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(p => p.FindPackageRegistrationById("pkgid")).Returns(package);
var controller = CreateController(packageSvc: packageSvc);
@@ -256,9 +256,9 @@ public void CallsSendContactOwnersMessageWithUserInfo()
userSvc: userSvc,
httpContext: httpContext);
var model = new ContactOwnersViewModel
- {
- Message = "I like the cut of your jib",
- };
+ {
+ Message = "I like the cut of your jib",
+ };
var result = controller.ContactOwners("factory", model) as RedirectToRouteResult;
@@ -273,11 +273,11 @@ public void UpdatesUnlistedIfSelected()
{
// Arrange
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "Foo" },
- Version = "1.0",
- Listed = true
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "Foo" },
+ Version = "1.0",
+ Listed = true
+ };
package.PackageRegistration.Owners.Add(new User("Frodo", "foo"));
var packageService = new Mock<IPackageService>(MockBehavior.Strict);
@@ -306,11 +306,11 @@ public void UpdatesUnlistedIfNotSelected()
{
// Arrange
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "Foo" },
- Version = "1.0",
- Listed = true
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "Foo" },
+ Version = "1.0",
+ Listed = true
+ };
package.PackageRegistration.Owners.Add(new User("Frodo", "foo"));
var packageService = new Mock<IPackageService>(MockBehavior.Strict);
@@ -365,10 +365,10 @@ public void SendsMessageToGalleryOwnerWithEmailOnlyWhenUnauthenticated()
It.IsAny<Package>(),
"Mordor took my finger"));
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "mordor" },
- Version = "2.0.1"
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "mordor" },
+ Version = "2.0.1"
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(p => p.FindPackageByIdAndVersion("mordor", "2.0.1", true)).Returns(package);
var httpContext = new Mock<HttpContextBase>();
@@ -378,10 +378,10 @@ public void SendsMessageToGalleryOwnerWithEmailOnlyWhenUnauthenticated()
messageSvc: messageService,
httpContext: httpContext);
var model = new ReportAbuseViewModel
- {
- Email = "frodo@hobbiton.example.com",
- Message = "Mordor took my finger."
- };
+ {
+ Email = "frodo@hobbiton.example.com",
+ Message = "Mordor took my finger."
+ };
var result = controller.ReportAbuse("mordor", "2.0.1", model) as RedirectToRouteResult;
@@ -404,10 +404,10 @@ public void SendsMessageToGalleryOwnerWithUserInfoWhenAuthenticated()
It.IsAny<Package>(),
"Mordor took my finger"));
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "mordor" },
- Version = "2.0.1"
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "mordor" },
+ Version = "2.0.1"
+ };
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(p => p.FindPackageByIdAndVersion("mordor", It.IsAny<string>(), true)).Returns(package);
var httpContext = new Mock<HttpContextBase>();
@@ -421,9 +421,9 @@ public void SendsMessageToGalleryOwnerWithUserInfoWhenAuthenticated()
userSvc: userSvc,
httpContext: httpContext);
var model = new ReportAbuseViewModel
- {
- Message = "Mordor took my finger."
- };
+ {
+ Message = "Mordor took my finger."
+ };
var result = controller.ReportAbuse("mordor", "2.0.1", model) as RedirectToRouteResult;
@@ -578,7 +578,7 @@ public void WillShowTheViewWithErrorsWhenThePackageIdIsAlreadyBeingUsed()
var fakeIdentity = new Mock<IIdentity>();
fakeIdentity.Setup(x => x.Name).Returns("theUsername");
var fakePackageRegistration = new PackageRegistration
- { Id = "theId", Owners = new[] { new User { Key = 1 /* not the current user */ } } };
+ { Id = "theId", Owners = new[] { new User { Key = 1 /* not the current user */ } } };
var fakePackageSvc = new Mock<IPackageService>();
fakePackageSvc.Setup(x => x.FindPackageRegistrationById(It.IsAny<string>())).Returns(fakePackageRegistration);
var controller = CreateController(
@@ -1220,11 +1220,11 @@ public void WillExtractNuGetExe()
fakeUploadFileSvc.Setup(x => x.GetUploadFile(42)).Returns(Stream.Null);
var fakePackageSvc = new Mock<IPackageService>();
var commandLinePackage = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "NuGet.CommandLine" },
- Version = "2.0.0",
- IsLatestStable = true
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "NuGet.CommandLine" },
+ Version = "2.0.0",
+ IsLatestStable = true
+ };
fakePackageSvc.Setup(x => x.CreatePackage(It.IsAny<IPackage>(), It.IsAny<User>())).Returns(commandLinePackage);
var nugetExeDownloader = new Mock<INuGetExeDownloaderService>(MockBehavior.Strict);
nugetExeDownloader.Setup(d => d.UpdateExecutable(It.IsAny<IPackage>())).Verifiable();
@@ -1256,11 +1256,11 @@ public void WillNotExtractNuGetExeIfIsNotLatestStable()
fakeUploadFileSvc.Setup(x => x.GetUploadFile(42)).Returns(Stream.Null);
var fakePackageSvc = new Mock<IPackageService>();
var commandLinePackage = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "NuGet.CommandLine" },
- Version = "2.0.0",
- IsLatestStable = false
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "NuGet.CommandLine" },
+ Version = "2.0.0",
+ IsLatestStable = false
+ };
fakePackageSvc.Setup(x => x.CreatePackage(It.IsAny<IPackage>(), It.IsAny<User>())).Returns(commandLinePackage);
var nugetExeDownloader = new Mock<INuGetExeDownloaderService>(MockBehavior.Strict);
var controller = CreateController(
@@ -1294,7 +1294,7 @@ public void WillNotExtractNuGetExeIfIsItDoesNotMatchId(string id)
fakeUploadFileSvc.Setup(x => x.GetUploadFile(42)).Returns(Stream.Null);
var fakePackageSvc = new Mock<IPackageService>();
var commandLinePackage = new Package
- { PackageRegistration = new PackageRegistration { Id = id }, Version = "2.0.0", IsLatestStable = true };
+ { PackageRegistration = new PackageRegistration { Id = id }, Version = "2.0.0", IsLatestStable = true };
fakePackageSvc.Setup(x => x.CreatePackage(It.IsAny<IPackage>(), It.IsAny<User>())).Returns(commandLinePackage);
var nugetExeDownloader = new Mock<INuGetExeDownloaderService>(MockBehavior.Strict);
var controller = CreateController(
88 Facts/Controllers/UsersControllerFacts.cs
View
@@ -64,12 +64,12 @@ protected override IIdentity Identity
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICuratedFeedsByManagerQuery))
+ if (typeof(T) == typeof(ICuratedFeedsByManagerQuery))
{
return (T)StubCuratedFeedsByManagerQry.Object;
}
- if (typeof (T) == typeof (IUserByUsernameQuery))
+ if (typeof(T) == typeof(IUserByUsernameQuery))
{
return (T)StubUserByUsernameQry.Object;
}
@@ -148,10 +148,10 @@ public void Returns404WhenTokenIsEmpty()
public void ReturnsConfirmedWhenTokenMatchesUser()
{
var user = new User
- {
- UnconfirmedEmailAddress = "email@example.com",
- EmailConfirmationToken = "the-token"
- };
+ {
+ UnconfirmedEmailAddress = "email@example.com",
+ EmailConfirmationToken = "the-token"
+ };
var userService = new Mock<IUserService>();
userService.Setup(u => u.FindByUsername("username")).Returns(user);
userService.Setup(u => u.ConfirmEmailAddress(user, "the-token")).Returns(true);
@@ -167,11 +167,11 @@ public void SendsAccountChangedNoticeWhenConfirmingChangedEmail()
{
var userService = new Mock<IUserService>();
var user = new User
- {
- EmailAddress = "old@example.com",
- UnconfirmedEmailAddress = "new@example.com",
- EmailConfirmationToken = "the-token"
- };
+ {
+ EmailAddress = "old@example.com",
+ UnconfirmedEmailAddress = "new@example.com",
+ EmailConfirmationToken = "the-token"
+ };
userService.Setup(u => u.FindByUsername("username")).Returns(user);
userService.Setup(u => u.ConfirmEmailAddress(user, "the-token")).Returns(true);
var messageService = new Mock<IMessageService>();
@@ -189,11 +189,11 @@ public void SendsAccountChangedNoticeWhenConfirmingChangedEmail()
public void ReturnsFalseWhenTokenDoesNotMatchUser()
{
var user = new User
- {
- EmailAddress = "old@example.com",
- UnconfirmedEmailAddress = "new@example.com",
- EmailConfirmationToken = "the-token"
- };
+ {
+ EmailAddress = "old@example.com",
+ UnconfirmedEmailAddress = "new@example.com",
+ EmailConfirmationToken = "the-token"
+ };
var userService = new Mock<IUserService>();
userService.Setup(u => u.FindByUsername("username")).Returns(user);
userService.Setup(u => u.ConfirmEmailAddress(user, "not-the-token")).Returns(false);
@@ -211,10 +211,10 @@ public class TheEditMethod
public void UpdatesEmailAllowedSetting()
{
var user = new User
- {
- EmailAddress = "test@example.com",
- EmailAllowed = true
- };
+ {
+ EmailAddress = "test@example.com",
+ EmailAllowed = true
+ };
var userService = new Mock<IUserService>();
userService.Setup(u => u.FindByUsername(It.IsAny<string>())).Returns(user);
@@ -233,10 +233,10 @@ public void UpdatesEmailAllowedSetting()
public void SendsEmailChangeConfirmationNoticeWhenEmailConfirmationTokenChanges()
{
var user = new User
- {
- EmailAddress = "test@example.com",
- EmailAllowed = true
- };
+ {
+ EmailAddress = "test@example.com",
+ EmailAllowed = true
+ };
var userService = new Mock<IUserService>();
userService.Setup(u => u.FindByUsername(It.IsAny<string>())).Returns(user);
@@ -256,11 +256,11 @@ public void SendsEmailChangeConfirmationNoticeWhenEmailConfirmationTokenChanges(
public void DoesNotSendEmailChangeConfirmationNoticeWhenTokenDoesNotChange()
{
var user = new User
- {
- EmailAddress = "old@example.com",
- EmailAllowed = true,
- EmailConfirmationToken = "token"
- };
+ {
+ EmailAddress = "old@example.com",
+ EmailAllowed = true,
+ EmailConfirmationToken = "token"
+ };
var userService = new Mock<IUserService>();
userService.Setup(u => u.FindByUsername(It.IsAny<string>())).Returns(user);
@@ -296,12 +296,12 @@ public class TheForgotPasswordMethod
public void SendsEmailWithPasswordResetUrl()
{
var user = new User
- {
- EmailAddress = "some@example.com",
- Username = "somebody",
- PasswordResetToken = "confirmation",
- PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1)
- };
+ {
+ EmailAddress = "some@example.com",
+ Username = "somebody",
+ PasswordResetToken = "confirmation",
+ PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1)
+ };
var messageService = new Mock<IMessageService>();
const string resetUrl = "https://example.org/?Controller=Users&Action=ResetPassword&username=somebody&token=confirmation";
messageService.Setup(
@@ -344,7 +344,7 @@ public void ReturnsSameViewIfTokenGenerationFails()
var result = controller.ForgotPassword(model) as ViewResult;
Assert.NotNull(result);
- Assert.IsNotType(typeof (RedirectResult), result);
+ Assert.IsNotType(typeof(RedirectResult), result);
}
}
@@ -490,10 +490,10 @@ public void ShowsErrorIfTokenExpired()
userService.Setup(u => u.ResetPasswordWithToken("user", "token", "newpwd")).Returns(false);
var controller = CreateController(userSvc: userService);
var model = new PasswordResetViewModel
- {
- ConfirmPassword = "pwd",
- NewPassword = "newpwd"
- };
+ {
+ ConfirmPassword = "pwd",
+ NewPassword = "newpwd"
+ };
controller.ResetPassword("user", "token", model);
@@ -508,10 +508,10 @@ public void ResetsPasswordForValidToken()
userService.Setup(u => u.ResetPasswordWithToken("user", "token", "newpwd")).Returns(true);
var controller = CreateController(userSvc: userService);
var model = new PasswordResetViewModel
- {
- ConfirmPassword = "pwd",
- NewPassword = "newpwd"
- };
+ {
+ ConfirmPassword = "pwd",
+ NewPassword = "newpwd"
+ };
var result = controller.ResetPassword("user", "token", model) as RedirectToRouteResult;
18 Facts/PackageCurators/WebMatrixPackageCuratorFacts.cs
View
@@ -26,12 +26,12 @@ public TestableWebMatrixPackageCurator()
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICreateCuratedPackageCommand))
+ if (typeof(T) == typeof(ICreateCuratedPackageCommand))
{
return (T)StubCreatedCuratedPackageCmd.Object;
}
- if (typeof (T) == typeof (ICuratedFeedByNameQuery))
+ if (typeof(T) == typeof(ICuratedFeedByNameQuery))
{
return (T)StubCuratedFeedByNameQry.Object;
}
@@ -239,13 +239,13 @@ public void WillSetTheAutomaticBitWhenIncludingThePackage()
private static Package CreateStubGalleryPackage()
{
return new Package
- {
- IsLatestStable = true,
- PackageRegistration = new PackageRegistration
- {
- Key = 0,
- },
- };
+ {
+ IsLatestStable = true,
+ PackageRegistration = new PackageRegistration
+ {
+ Key = 0,
+ },
+ };
}
private static Mock<IPackage> CreateStubNuGetPackage()
18 Facts/PackageCurators/Windows8PackageCuratorFacts.cs
View
@@ -27,12 +27,12 @@ public TestableWindows8PackageCurator()
protected override T GetService<T>()
{
- if (typeof (T) == typeof (ICreateCuratedPackageCommand))
+ if (typeof(T) == typeof(ICreateCuratedPackageCommand))
{
return (T)StubCreatedCuratedPackageCmd.Object;
}
- if (typeof (T) == typeof (ICuratedFeedByNameQuery))
+ if (typeof(T) == typeof(ICuratedFeedByNameQuery))
{
return (T)StubCuratedFeedByNameQry.Object;
}
@@ -187,13 +187,13 @@ public void WillSetTheAutomaticBitWhenIncludingThePackage()
private static Package CreateStubGalleryPackage()
{
return new Package
- {
- IsLatestStable = true,
- PackageRegistration = new PackageRegistration
- {
- Key = 0,
- },
- };
+ {
+ IsLatestStable = true,
+ PackageRegistration = new PackageRegistration
+ {
+ Key = 0,
+ },
+ };
}
private static Mock<IPackage> CreateStubNuGetPackage()
8 Facts/Services/CloudBlobFileStorageServiceFacts.cs
View
@@ -38,10 +38,10 @@ public FolderNamesDataAttribute(bool includePermissions = false)
Type[] parameterTypes)
{
var folderNames = new List<object[]>
- {
- new object[] { Constants.PackagesFolderName, true },
- new object[] { Constants.UploadsFolderName, false }
- };
+ {
+ new object[] { Constants.PackagesFolderName, true },
+ new object[] { Constants.UploadsFolderName, false }
+ };
if (!IncludePermissions)
{
32 Facts/Services/MessageServiceFacts.cs
View
@@ -15,10 +15,10 @@ public void WillSendEmailToGalleryOwner()
{
var from = new MailAddress("legit@example.com", "too");
var package = new Package
- {
- PackageRegistration = new PackageRegistration { Id = "smangit" },
- Version = "1.42.0.1"
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = "smangit" },
+ Version = "1.42.0.1"
+ };
var mailSender = new Mock<IMailSender>();
var setting = new GallerySetting { GalleryOwnerName = "NuGet Gallery", GalleryOwnerEmail = "joe@example.com" };
var messageService = new MessageService(mailSender.Object, setting);
@@ -42,10 +42,10 @@ public void WillSendEmailToAllOwners()
var from = new MailAddress("smangit@example.com", "flossy");
var package = new PackageRegistration { Id = "smangit" };
package.Owners = new[]
- {
- new User { EmailAddress = "yung@example.com", EmailAllowed = true },
- new User { EmailAddress = "flynt@example.com", EmailAllowed = true }
- };
+ {
+ new User { EmailAddress = "yung@example.com", EmailAllowed = true },
+ new User { EmailAddress = "flynt@example.com", EmailAllowed = true }
+ };
var mailSender = new Mock<IMailSender>();
var setting = new GallerySetting { GalleryOwnerName = "NuGet Gallery", GalleryOwnerEmail = "joe@example.com" };
var messageService = new MessageService(mailSender.Object, setting);
@@ -69,10 +69,10 @@ public void WillNotSendEmailToOwnerThatOptsOut()
var from = new MailAddress("smangit@example.com", "flossy");
var package = new PackageRegistration { Id = "smangit" };
package.Owners = new[]
- {
- new User { EmailAddress = "yung@example.com", EmailAllowed = true },
- new User { EmailAddress = "flynt@example.com", EmailAllowed = false }
- };
+ {
+ new User { EmailAddress = "yung@example.com", EmailAllowed = true },
+ new User { EmailAddress = "flynt@example.com", EmailAllowed = false }
+ };
var mailSender = new Mock<IMailSender>();
var setting = new GallerySetting { GalleryOwnerName = "Joe Schmoe", GalleryOwnerEmail = "joe@example.com" };
var messageService = new MessageService(mailSender.Object, setting);
@@ -92,10 +92,10 @@ public void WillNotAttemptToSendIfNoOwnersAllow()
var from = new MailAddress("smangit@example.com", "flossy");
var package = new PackageRegistration { Id = "smangit" };
package.Owners = new[]
- {
- new User { EmailAddress = "yung@example.com", EmailAllowed = false },
- new User { EmailAddress = "flynt@example.com", EmailAllowed = false }
- };
+ {
+ new User { EmailAddress = "yung@example.com", EmailAllowed = false },
+ new User { EmailAddress = "flynt@example.com", EmailAllowed = false }
+ };
var mailSender = new Mock<IMailSender>();
mailSender.Setup(m => m.Send(It.IsAny<MailMessage>())).Throws(new InvalidOperationException());
var setting = new GallerySetting { GalleryOwnerName = "Joe Schmoe", GalleryOwnerEmail = "joe@example.com" };
10 Facts/Services/NuGetExeDownloaderServiceFacts.cs
View
@@ -81,11 +81,11 @@ public void UpdateExecutableExtractsExeToFileStorage()
private static Stream CreateCommandLinePackage()
{
var packageBuilder = new PackageBuilder
- {
- Id = "NuGet.CommandLine",
- Version = new SemanticVersion("2.0.0"),
- Description = "Some desc"
- };
+ {
+ Id = "NuGet.CommandLine",
+ Version = new SemanticVersion("2.0.0"),
+ Description = "Some desc"
+ };
packageBuilder.Authors.Add("test");
var exeFile = CreateExePackageFile();
packageBuilder.Files.Add(exeFile);
202 Facts/Services/PackageServiceFacts.cs
View
@@ -14,10 +14,10 @@ public class PackageServiceFacts
private static Package CreatePackage(string id, string version)
{
return new Package
- {
- PackageRegistration = new PackageRegistration { Id = id },
- Version = version,
- };
+ {
+ PackageRegistration = new PackageRegistration { Id = id },
+ Version = version,
+ };
}
private static Mock<IPackage> CreateNuGetPackage(Action<Mock<IPackage>> setup = null)
@@ -518,10 +518,10 @@ private void WillSaveTheCreatedPackageWhenThePackageRegistrationAlreadyExisted()
{
var currentUser = new User();
var packageRegistration = new PackageRegistration
- {
- Id = "theId",
- Owners = new HashSet<User> { currentUser },
- };
+ {
+ Id = "theId",
+ Owners = new HashSet<User> { currentUser },
+ };
var packageRegistrationRepo = new Mock<IEntityRepository<PackageRegistration>>();
var service = CreateService(
packageRegistrationRepo: packageRegistrationRepo,
@@ -542,10 +542,10 @@ private void WillThrowIfThePackageRegistrationAlreadyExistsAndTheCurrentUserIsNo
{
var currentUser = new User();
var packageRegistration = new PackageRegistration
- {
- Id = "theId",
- Owners = new HashSet<User>()
- };
+ {
+ Id = "theId",
+ Owners = new HashSet<User>()
+ };
var packageRegistrationRepo = new Mock<IEntityRepository<PackageRegistration>>();
var service = CreateService(
packageRegistrationRepo: packageRegistrationRepo,
@@ -1012,11 +1012,11 @@ public void WillGetTheLatestVersionWhenTheVersionArgumentIsNull()
{
var packageRegistration = new PackageRegistration { Id = "theId" };
var packages = new[]
- {
- new Package { Version = "1.0", PackageRegistration = packageRegistration },
- new Package
- { Version = "2.0", PackageRegistration = packageRegistration, IsLatestStable = true, IsLatest = true }
- }.AsQueryable();
+ {
+ new Package { Version = "1.0", PackageRegistration = packageRegistration },
+ new Package
+ { Version = "2.0", PackageRegistration = packageRegistration, IsLatestStable = true, IsLatest = true }
+ }.AsQueryable();
var packageRepo = new Mock<IEntityRepository<Package>>();
packageRepo.Setup(r => r.GetAll()).Returns(packages);
var service = CreateService(packageRepo: packageRepo);
@@ -1134,24 +1134,24 @@ public void OnPackageVersionHigherThanLatestSetsItToLatestVersion()
{
var packageRegistration = new PackageRegistration { Id = "theId" };
var packages = new[]
- {
- new Package
- {
- Version = "1.0.1",
- PackageRegistration = packageRegistration,
- Listed = false,
- IsLatest = false,
- IsLatestStable = false
- },
- new Package
- {
- Version = "1.0.0",
- PackageRegistration = packageRegistration,
- Listed = true,
- IsLatest = true,
- IsLatestStable = true
- }
- }.ToList();
+ {
+ new Package
+ {
+ Version = "1.0.1",
+ PackageRegistration = packageRegistration,
+ Listed = false,
+ IsLatest = false,
+ IsLatestStable = false
+ },
+ new Package
+ {
+ Version = "1.0.0",
+ PackageRegistration = packageRegistration,
+ Listed = true,
+ IsLatest = true,
+ IsLatestStable = true
+ }
+ }.ToList();
packageRegistration.Packages = packages;
var packageRepo = new Mock<IEntityRepository<Package>>();
var service = CreateService(packageRepo: packageRepo);
@@ -1185,12 +1185,12 @@ public void OnLatestPackageVersionSetsPreviousToLatestVersion()
{
var packageRegistration = new PackageRegistration { Id = "theId" };
var packages = new[]
- {
- new Package
- { Version = "1.0.1", PackageRegistration = packageRegistration, IsLatest = true, IsLatestStable = true },
- new Package
- { Version = "1.0.0", PackageRegistration = packageRegistration, IsLatest = false, IsLatestStable = false }
- }.ToList();
+ {
+ new Package
+ { Version = "1.0.1", PackageRegistration = packageRegistration, IsLatest = true, IsLatestStable = true },
+ new Package
+ { Version = "1.0.0", PackageRegistration = packageRegistration, IsLatest = false, IsLatestStable = false }
+ }.ToList();
packageRegistration.Packages = packages;
var packageRepo = new Mock<IEntityRepository<Package>>();
var service = CreateService(packageRepo: packageRepo);
@@ -1225,14 +1225,14 @@ public class ThePublishPackageMethod
public void WillSetThePublishedDateOnThePackageBeingPublished()
{
var package = new Package
- {
- Version = "1.0.42",
- PackageRegistration = new PackageRegistration
- {
- Id = "theId",
- Packages = new HashSet<Package>()
- }
- };
+ {
+ Version = "1.0.42",
+ PackageRegistration = new PackageRegistration
+ {
+ Id = "theId",
+ Packages = new HashSet<Package>()
+ }
+ };
package.PackageRegistration.Packages.Add(package);
var packageRepo = new Mock<IEntityRepository<Package>>();
var service = CreateService(
@@ -1250,14 +1250,14 @@ public void WillSetThePublishedDateOnThePackageBeingPublished()
public void WillSetUpdateIsLatestStableOnThePackageWhenItIsTheLatestVersion()
{
var package = new Package
- {
- Version = "1.0.42",
- PackageRegistration = new PackageRegistration
- {
- Id = "theId",
- Packages = new HashSet<Package>()
- }
- };
+ {
+ Version = "1.0.42",
+ PackageRegistration = new PackageRegistration
+ {
+ Id = "theId",
+ Packages = new HashSet<Package>()
+ }
+ };
package.PackageRegistration.Packages.Add(package);
package.PackageRegistration.Packages.Add(new Package { Version = "1.0", PackageRegistration = package.PackageRegistration });
var packageRepo = new Mock<IEntityRepository<Package>>();
@@ -1275,14 +1275,14 @@ public void WillSetUpdateIsLatestStableOnThePackageWhenItIsTheLatestVersion()
public void WillNotSetUpdateIsLatestStableOnThePackageWhenItIsNotTheLatestVersion()
{
var package = new Package
- {
- Version = "1.0.42",
- PackageRegistration = new PackageRegistration
- {
- Id = "theId",
- Packages = new HashSet<Package>()
- }
- };
+ {
+ Version = "1.0.42",
+ PackageRegistration = new PackageRegistration
+ {
+ Id = "theId",
+ Packages = new HashSet<Package>()
+ }
+ };
package.PackageRegistration.Packages.Add(package);
package.PackageRegistration.Packages.Add(
new Package
@@ -1306,23 +1306,23 @@ public void WillNotSetUpdateIsLatestStableOnThePackageWhenItIsNotTheLatestVersio
public void SetUpdateUpdatesIsAbsoluteLatestForPrereleasePackage()
{
var package = new Package
- {
- Version = "1.0.42-alpha",
- Published = DateTime.Now,
- PackageRegistration = new PackageRegistration
- {
- Id = "theId",
- Packages = new HashSet<Package>()
- },
- IsPrerelease = true,
- };
+ {
+ Version = "1.0.42-alpha",
+ Published = DateTime.Now,
+ PackageRegistration = new PackageRegistration
+ {
+ Id = "theId",
+ Packages = new HashSet<Package>()
+ },
+ IsPrerelease = true,
+ };
package.PackageRegistration.Packages.Add(package);
var package39 = new Package
- {
- Version = "1.0.39",
- PackageRegistration = package.PackageRegistration,
- Published = DateTime.Now.AddDays(-1)
- };
+ {
+ Version = "1.0.39",
+ PackageRegistration = package.PackageRegistration,
+ Published = DateTime.Now.AddDays(-1)
+ };
package.PackageRegistration.Packages.Add(package39);
var packageRepo = new Mock<IEntityRepository<Package>>();
var service = CreateService(
@@ -1341,24 +1341,24 @@ public void SetUpdateUpdatesIsAbsoluteLatestForPrereleasePackage()
public void SetUpdateDoesNotSetIsLatestStableForAnyIfAllPackagesArePrerelease()
{
var package = new Package
- {
- Version = "1.0.42-alpha",
- Published = DateTime.Now,
- IsPrerelease = true,
- PackageRegistration = new PackageRegistration
- {
- Id = "theId",
- Packages = new HashSet<Package>()
- }
- };
+ {
+ Version = "1.0.42-alpha",
+ Published = DateTime.Now,
+ IsPrerelease = true,
+ PackageRegistration = new PackageRegistration
+ {
+ Id = "theId",
+ Packages = new HashSet<Package>()
+ }
+ };
package.PackageRegistration.Packages.Add(package);
var package39 = new Package
- {
- Version = "1.0.39-beta",
- PackageRegistration = package.PackageRegistration,
- Published = DateTime.Now.AddDays(-1),
- IsPrerelease = true
- };
+ {
+ Version = "1.0.39-beta",
+ PackageRegistration = package.PackageRegistration,
+ Published = DateTime.Now.AddDays(-1),
+ IsPrerelease = true
+ };
package.PackageRegistration.Packages.Add(package39);
var packageRepo = new Mock<IEntityRepository<Package>>();
var service = CreateService(
@@ -1408,11 +1408,11 @@ public void RemovesPackageOwner()
public void RemovesPendingPackageOwner()
{
var packageOwnerRequest = new PackageOwnerRequest
- {
- PackageRegistrationKey = 1,
- RequestingOwnerKey = 99,
- NewOwnerKey = 200
- };
+ {
+ PackageRegistrationKey = 1,
+ RequestingOwnerKey = 99,
+ NewOwnerKey = 200
+ };
var packageOwnerRequestRepository = new Mock<IEntityRepository<PackageOwnerRequest>>();
packageOwnerRequestRepository.Setup(r => r.GetAll()).Returns(new[] { packageOwnerRequest }.AsQueryable());
packageOwnerRequestRepository.Setup(r => r.DeleteOnCommit(packageOwnerRequest)).Verifiable();
120 Facts/Services/UsersServiceFacts.cs
View
@@ -120,11 +120,11 @@ public void WithTokenThatDoesNotMatchUserReturnsFalse()
public void WithTokenThatDoesMatchUserConfirmsUserAndReturnsTrue()
{
var user = new User
- {
- Username = "username",
- EmailConfirmationToken = "secret",
- UnconfirmedEmailAddress = "new@example.com"
- };
+ {
+ Username = "username",
+ EmailConfirmationToken = "secret",
+ UnconfirmedEmailAddress = "new@example.com"
+ };
var service = CreateUsersService();
var confirmed = service.ConfirmEmailAddress(user, "secret");
@@ -140,12 +140,12 @@ public void WithTokenThatDoesMatchUserConfirmsUserAndReturnsTrue()
public void ForUserWithConfirmedEmailWithTokenThatDoesMatchUserConfirmsUserAndReturnsTrue()
{
var user = new User
- {
- Username = "username",
- EmailConfirmationToken = "secret",
- EmailAddress = "existing@example.com",
- UnconfirmedEmailAddress = "new@example.com"
- };
+ {
+ Username = "username",
+ EmailConfirmationToken = "secret",
+ EmailAddress = "existing@example.com",
+ UnconfirmedEmailAddress = "new@example.com"
+ };
var service = CreateUsersService();
var confirmed = service.ConfirmEmailAddress(user, "secret");
@@ -377,12 +377,12 @@ public class TheFindByUsernameOrEmailAddressAndPasswordMethod
public void FindsUsersByUserName()
{
var user = new User
- {
- Username = "theUsername",
- HashedPassword = "thePassword",
- EmailAddress = "test@example.com",
- PasswordHashAlgorithm = "PBKDF2"
- };
+ {
+ Username = "theUsername",
+ HashedPassword = "thePassword",
+ EmailAddress = "test@example.com",
+ PasswordHashAlgorithm = "PBKDF2"
+ };
var userRepository = new Mock<IEntityRepository<User>>();
userRepository.Setup(r => r.GetAll()).Returns(new[] { user }.AsQueryable());
@@ -400,12 +400,12 @@ public void FindsUsersByUserName()
public void FindsUsersByEmailAddress()
{
var user = new User
- {
- Username = "theUsername",
- HashedPassword = "thePassword",
- EmailAddress = "test@example.com",
- PasswordHashAlgorithm = "PBKDF2"
- };
+ {
+ Username = "theUsername",
+ HashedPassword = "thePassword",
+ EmailAddress = "test@example.com",
+ PasswordHashAlgorithm = "PBKDF2"
+ };
var userRepository = new Mock<IEntityRepository<User>>();
userRepository.Setup(r => r.GetAll()).Returns(new[] { user }.AsQueryable());
@@ -423,12 +423,12 @@ public void FindsUsersByEmailAddress()
public void FindsUsersUpdatesPasswordIfUsingLegacyHashAlgorithm()
{
var user = new User
- {
- Username = "theUsername",
- HashedPassword = "theHashedPassword",
- EmailAddress = "test@example.com",
- PasswordHashAlgorithm = "SHA1"
- };
+ {
+ Username = "theUsername",
+ HashedPassword = "theHashedPassword",
+ EmailAddress = "test@example.com",
+ PasswordHashAlgorithm = "SHA1"
+ };
var userRepository = new Mock<IEntityRepository<User>>();
userRepository.Setup(r => r.GetAll()).Returns(new[] { user }.AsQueryable());
userRepository.Setup(r => r.CommitChanges()).Verifiable();
@@ -532,12 +532,12 @@ public void SetsPasswordResetTokenUsingEmail()
public void WithExistingNotYetExpiredTokenReturnsExistingToken()
{
var user = new User
- {
- Username = "user",
- EmailAddress = "confirmed@example.com",
- PasswordResetToken = "existing-token",
- PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1)
- };
+ {
+ Username = "user",
+ EmailAddress = "confirmed@example.com",
+ PasswordResetToken = "existing-token",
+ PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1)
+ };
var cryptoSvc = new Mock<ICryptographyService>();
cryptoSvc.Setup(s => s.GenerateToken()).Throws(new InvalidOperationException("Should not get called"));
var userSvc = CreateUsersService(
@@ -559,12 +559,12 @@ public void WithExistingNotYetExpiredTokenReturnsExistingToken()
public void WithExistingExpiredTokenReturnsNewToken()
{
var user = new User
- {
- Username = "user",
- EmailAddress = "confirmed@example.com",
- PasswordResetToken = "existing-token",
- PasswordResetTokenExpirationDate = DateTime.UtcNow.AddMilliseconds(-1)
- };
+ {
+ Username = "user",
+ EmailAddress = "confirmed@example.com",
+ PasswordResetToken = "existing-token",
+ PasswordResetTokenExpirationDate = DateTime.UtcNow.AddMilliseconds(-1)
+ };
var cryptoSvc = new Mock<ICryptographyService>();
cryptoSvc.Setup(s => s.GenerateToken()).Returns("reset-token");
var userSvc = CreateUsersService(
@@ -603,11 +603,11 @@ public void ReturnsFalseIfUserNotFound()
public void ThrowsExceptionIfUserNotConfirmed()
{
var user = new User
- {
- Username = "user",
- PasswordResetToken = "some-token",
- PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1)
- };
+ {
+ Username = "user",
+ PasswordResetToken = "some-token",
+ PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1)
+ };
var crypto = new Mock<ICryptographyService>();
crypto.Setup(c => c.GenerateSaltedHash("new-password", Constants.Sha512HashAlgorithmId)).Returns("bacon-hash-and-eggs");
var userRepository = new Mock<IEntityRepository<User>>();
@@ -621,13 +621,13 @@ public void ThrowsExceptionIfUserNotConfirmed()
public void ResetsPasswordAndPasswordTokenAndPasswordTokenDate()
{
var user = new User
- {
- Username = "user",
- EmailAddress = "confirmed@example.com",
- PasswordResetToken = "some-token",
- PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1),
- PasswordHashAlgorithm = "PBKDF2"
- };
+ {
+ Username = "user",
+ EmailAddress = "confirmed@example.com",
+ PasswordResetToken = "some-token",
+ PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1),
+ PasswordHashAlgorithm = "PBKDF2"
+ };
var crypto = new Mock<ICryptographyService>(MockBehavior.Strict);
crypto.Setup(c => c.GenerateSaltedHash("new-password", Constants.PBKDF2HashAlgorithmId)).Returns("bacon-hash-and-eggs");
var userRepository = new Mock<IEntityRepository<User>>();
@@ -647,13 +647,13 @@ public void ResetsPasswordAndPasswordTokenAndPasswordTokenDate()
public void ResetsPasswordMigratesPasswordHash()
{
var user = new User
- {
- Username = "user",
- EmailAddress = "confirmed@example.com",
- PasswordResetToken = "some-token",
- PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1),
- PasswordHashAlgorithm = "SHA1"
- };
+ {
+ Username = "user",
+ EmailAddress = "confirmed@example.com",
+ PasswordResetToken = "some-token",
+ PasswordResetTokenExpirationDate = DateTime.UtcNow.AddDays(1),
+ PasswordHashAlgorithm = "SHA1"
+ };
var crypto = new Mock<ICryptographyService>(MockBehavior.Strict);
crypto.Setup(c => c.GenerateSaltedHash("new-password", "PBKDF2")).Returns("bacon-hash-and-eggs");
var userRepository = new Mock<IEntityRepository<User>>();
34 Facts/ViewModels/DisplayPackageViewModelFacts.cs
View
@@ -9,25 +9,25 @@ public class DisplayPackageViewModelFacts
public void TheCtorSortsPackageVersionsProperly()
{
var package = new Package
- {
- Dependencies = Enumerable.Empty<PackageDependency>().ToList(),
- PackageRegistration = new PackageRegistration
- {
- Owners = Enumerable.Empty<User>().ToList(),
- }
- };
+ {
+ Dependencies = Enumerable.Empty<PackageDependency>().ToList(),
+ PackageRegistration = new PackageRegistration
+ {
+ Owners = Enumerable.Empty<User>().ToList(),
+ }
+ };
package.PackageRegistration.Packages = new[]
- {
- new Package { Version = "1.0.0-alpha2", PackageRegistration = package.PackageRegistration }
- ,
- new Package { Version = "1.0.0", PackageRegistration = package.PackageRegistration },
- new Package { Version = "1.0.0-alpha", PackageRegistration = package.PackageRegistration },
- new Package { Version = "1.0.0-beta", PackageRegistration = package.PackageRegistration },
- new Package { Version = "1.0.2-beta", PackageRegistration = package.PackageRegistration },
- new Package { Version = "1.0.2", PackageRegistration = package.PackageRegistration },
- new Package { Version = "1.0.10", PackageRegistration = package.PackageRegistration }
- };
+ {
+ new Package { Version = "1.0.0-alpha2", PackageRegistration = package.PackageRegistration }
+ ,
+ new Package { Version = "1.0.0", PackageRegistration = package.PackageRegistration },
+ new Package { Version = "1.0.0-alpha", PackageRegistration = package.PackageRegistration },
+ new Package { Version = "1.0.0-beta", PackageRegistration = package.PackageRegistration },
+ new Package { Version = "1.0.2-beta", PackageRegistration = package.PackageRegistration },
+ new Package { Version = "1.0.2", PackageRegistration = package.PackageRegistration },
+ new Package { Version = "1.0.10", PackageRegistration = package.PackageRegistration }
+ };
var packageVersions = new DisplayPackageViewModel(package).PackageVersions.ToList();
28 Website/App_Start/AppActivator.cs
View
@@ -18,9 +18,9 @@
using WebActivator;
using WebBackgrounder;
-[assembly: WebActivator.PreApplicationStartMethod(typeof (AppActivator), "PreStart")]
-[assembly: PostApplicationStartMethod(typeof (AppActivator), "PostStart")]
-[assembly: ApplicationShutdownMethod(typeof (AppActivator), "Stop")]
+[assembly: WebActivator.PreApplicationStartMethod(typeof(AppActivator), "PreStart")]
+[assembly: PostApplicationStartMethod(typeof(AppActivator), "PostStart")]
+[assembly: ApplicationShutdownMethod(typeof(AppActivator), "Stop")]
namespace NuGetGallery
{
@@ -60,16 +60,16 @@ private static void AppPostStart()
private static void BackgroundJobsPostStart()
{
var jobs = new IJob[]
- {
- new UpdateStatisticsJob(TimeSpan.FromMinutes(5), () => new EntitiesContext(), timeout: TimeSpan.FromMinutes(5)),
- new WorkItemCleanupJob(TimeSpan.FromDays(1), () => new EntitiesContext(), timeout: TimeSpan.FromDays(4)),
- new LuceneIndexingJob(TimeSpan.FromMinutes(10), timeout: TimeSpan.FromMinutes(2))
- };
+ {
+ new UpdateStatisticsJob(TimeSpan.FromMinutes(5), () => new EntitiesContext(), timeout: TimeSpan.FromMinutes(5)),
+ new WorkItemCleanupJob(TimeSpan.FromDays(1), () => new EntitiesContext(), timeout: TimeSpan.FromDays(4)),
+ new LuceneIndexingJob(TimeSpan.FromMinutes(10), timeout: TimeSpan.FromMinutes(2))
+ };
var jobCoordinator = new WebFarmJobCoordinator(new EntityWorkItemRepository(() => new EntitiesContext()));
_jobManager = new JobManager(jobs, jobCoordinator)
- {
- RestartSchedulerOnFailure = true
- };
+ {
+ RestartSchedulerOnFailure = true
+ };
_jobManager.Fail(e => ErrorLog.GetDefault(null).Log(new Error(e)));
_jobManager.Start();
}
@@ -96,7 +96,7 @@ private static void DynamicDataPostStart()
private static void MiniProfilerPreStart()
{
MiniProfilerEF.Initialize();
- DynamicModuleUtility.RegisterModule(typeof (MiniProfilerStartupModule));
+ DynamicModuleUtility.RegisterModule(typeof(MiniProfilerStartupModule));
GlobalFilters.Filters.Add(new ProfilingActionFilter());
}
@@ -112,8 +112,8 @@ private static void MiniProfilerPostStart()
private static void NinjectPreStart()
{
- DynamicModuleUtility.RegisterModule(typeof (OnePerRequestModule));
- DynamicModuleUtility.RegisterModule(typeof (HttpApplicationInitializationModule));
+ DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule));
+ DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule));
NinjectBootstrapper.Initialize(() => Container.Kernel);
}
4 Website/App_Start/AuthenticationModule.cs
View
@@ -6,7 +6,7 @@
using Microsoft.Web.Infrastructure.DynamicModuleHelper;
using NuGetGallery;
-[assembly: WebActivator.PreApplicationStartMethod(typeof (AuthenticationModule), "Start")]
+[assembly: WebActivator.PreApplicationStartMethod(typeof(AuthenticationModule), "Start")]
namespace NuGetGallery
{
@@ -23,7 +23,7 @@ public void Dispose()
public static void Start()
{
- DynamicModuleUtility.RegisterModule(typeof (AuthenticationModule));
+ DynamicModuleUtility.RegisterModule(typeof(AuthenticationModule));
}
private void OnAuthenticateRequest(object sender, EventArgs e)
2  Website/App_Start/Configuration.cs
View
@@ -53,7 +53,7 @@ public PackageStoreType PackageStoreType
{
return ReadAppSettings(
"PackageStoreType",
- value => (PackageStoreType)Enum.Parse(typeof (PackageStoreType), value ?? PackageStoreType.NotSpecified.ToString()));
+ value => (PackageStoreType)Enum.Parse(typeof(PackageStoreType), value ?? PackageStoreType.NotSpecified.ToString()));
}
}
20 Website/App_Start/ContainerBindings.cs
View
@@ -101,12 +101,12 @@ public override void Load()
if (settings.UseSmtp)
{
var mailSenderConfiguration = new MailSenderConfiguration
- {
- DeliveryMethod = SmtpDeliveryMethod.Network,
- Host = settings.SmtpHost,
- Port = settings.SmtpPort,
- EnableSsl = true
- };
+ {
+ DeliveryMethod = SmtpDeliveryMethod.Network,
+ Host = settings.SmtpHost,
+ Port = settings.SmtpPort,
+ EnableSsl = true
+ };
if (!String.IsNullOrWhiteSpace(settings.SmtpUsername))
{
@@ -121,10 +121,10 @@ public override void Load()
else
{
var mailSenderConfiguration = new MailSenderConfiguration
- {
- DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
- PickupDirectoryLocation = HostingEnvironment.MapPath("~/App_Data/Mail")
- };
+ {
+ DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
+ PickupDirectoryLocation = HostingEnvironment.MapPath("~/App_Data/Mail")
+ };
return new MailSender(mailSenderConfiguration);
}
10 Website/App_Start/Routes.cs
View
@@ -128,12 +128,12 @@ public static void RegisterRoutes(RouteCollection routes)
routes.MapServiceRoute(
RouteName.V1ApiFeed,
"api/v1/FeedService.svc",
- typeof (V1Feed));
+ typeof(V1Feed));
routes.MapServiceRoute(
"LegacyFeedService",
"v1/FeedService.svc",
- typeof (V1Feed));
+ typeof(V1Feed));
routes.MapRoute(
"v1" + RouteName.VerifyPackageKey,
@@ -166,7 +166,7 @@ public static void RegisterRoutes(RouteCollection routes)
routes.MapServiceRoute(
"v1" + RouteName.V1ApiFeed,
"api/v1",
- typeof (V1Feed));
+ typeof(V1Feed));
// V2 routes
routes.MapRoute(
@@ -223,12 +223,12 @@ public static void RegisterRoutes(RouteCollection routes)
routes.MapServiceRoute(
RouteName.V2ApiCuratedFeed,
"api/v2/curated-feed",
- typeof (V2CuratedFeed));
+ typeof(V2CuratedFeed));
routes.MapServiceRoute(
RouteName.V2ApiFeed,
"api/v2/",
- typeof (V2Feed));
+ typeof(V2Feed));
routes.MapRoute(
RouteName.DownloadNuGetExe,
12 Website/Commands/CreateCuratedPackageCommand.cs
View
@@ -39,12 +39,12 @@ public CreateCuratedPackageCommand(IEntitiesContext entities)
}
var curatedPackage = new CuratedPackage
- {
- PackageRegistrationKey = packageRegistration.Key,
- Included = included,
- AutomaticallyCurated = automaticallyCurated,
- Notes = notes,
- };
+ {
+ PackageRegistrationKey = packageRegistration.Key,
+ Included = included,
+ AutomaticallyCurated = automaticallyCurated,
+ Notes = notes,
+ };
curatedFeed.Packages.Add(curatedPackage);
10 Website/Controllers/JsonApiController.cs
View
@@ -38,11 +38,11 @@ public virtual object GetPackageOwners(string id, string version)
var owners = from u in package.PackageRegistration.Owners
select new OwnerModel
- {
- name = u.Username,
- current = u.Username == HttpContext.User.Identity.Name,
- pending = false
- };
+ {
+ name = u.Username,
+ current = u.Username == HttpContext.User.Identity.Name,
+ pending = false
+ };
var pending = from u in _packageOwnerRequestRepository.GetAll()
where u.PackageRegistrationKey == package.PackageRegistration.Key
36 Website/Controllers/PackagesController.cs
View
@@ -192,10 +192,10 @@ public virtual ActionResult ReportAbuse(string id, string version)
}
var model = new ReportAbuseViewModel
- {
- PackageId = id,
- PackageVersion = package.Version,
- };
+ {
+ PackageId = id,
+ PackageVersion = package.Version,
+ };
if (Request.IsAuthenticated)
{
@@ -253,10 +253,10 @@ public virtual ActionResult ContactOwners(string id)
}
var model = new ContactOwnersViewModel
- {
- PackageId = package.Id,
- Owners = package.Owners.Where(u => u.EmailAllowed)
- };
+ {
+ PackageId = package.Id,
+ Owners = package.Owners.Where(u => u.EmailAllowed)
+ };
return View(model);
}
@@ -389,10 +389,10 @@ public virtual ActionResult ConfirmOwner(string id, string username, string toke
}
var model = new PackageOwnerConfirmationModel
- {
- Success = _packageSvc.ConfirmPackageOwner(package, user, token),
- PackageId = id
- };
+ {
+ Success = _packageSvc.ConfirmPackageOwner(package, user, token),
+ PackageId = id
+ };
return View(model);
}
@@ -550,12 +550,12 @@ protected internal virtual IPackage ReadNuGetPackage(Stream stream)
private SearchFilter GetSearchFilter(string q, string sortOrder, int page, bool includePrerelease)
{
var searchFilter = new SearchFilter
- {
- SearchTerm = q,
- Skip = (page - 1) * Constants.DefaultPackageListPageSize, // pages are 1-based.
- Take = Constants.DefaultPackageListPageSize,
- IncludePrerelease = includePrerelease
- };
+ {
+ SearchTerm = q,
+ Skip = (page - 1) * Constants.DefaultPackageListPageSize, // pages are 1-based.
+ Take = Constants.DefaultPackageListPageSize,
+ IncludePrerelease = includePrerelease
+ };
switch (sortOrder)
{
46 Website/Controllers/UsersController.cs
View
@@ -46,11 +46,11 @@ public virtual ActionResult Edit()
{
var user = _userService.FindByUsername(_currentUser.Identity.Name);
var model = new EditProfileViewModel
- {
- EmailAddress = user.EmailAddress,
- EmailAllowed = user.EmailAllowed,
- PendingNewEmailAddress = user.UnconfirmedEmailAddress
- };
+ {
+ EmailAddress = user.EmailAddress,
+ EmailAllowed = user.EmailAllowed,
+ PendingNewEmailAddress = user.UnconfirmedEmailAddress
+ };
return View(model);
}
@@ -161,14 +161,14 @@ public virtual ActionResult Packages()
group p by p.PackageRegistration.Id;
var model = new ManagePackagesViewModel
- {
- Packages = from pr in published
- select new PackageViewModel(pr.First())
- {
- DownloadCount = pr.Sum(p => p.DownloadCount),
- Version = null
- },
- };
+ {
+ Packages = from pr in published
+ select new PackageViewModel(pr.First())
+ {
+ DownloadCount = pr.Sum(p => p.DownloadCount),
+ Version = null
+ },
+ };
return View(model);
}
@@ -274,10 +274,10 @@ public virtual ActionResult Confirm(string username, string token)
string existingEmail = user.EmailAddress;
var model = new EmailConfirmationModel
- {
- ConfirmingNewAccount = String.IsNullOrEmpty(existingEmail),
- SuccessfulConfirmation = _userService.ConfirmEmailAddress(user, token)
- };
+ {
+ ConfirmingNewAccount = String.IsNullOrEmpty(existingEmail),
+ SuccessfulConfirmation = _userService.ConfirmEmailAddress(user, token)
+ };
if (!model.ConfirmingNewAccount)
{
@@ -302,12 +302,12 @@ where p.Listed
.ToList();
var model = new UserProfileModel
- {
- Username = user.Username,
- EmailAddress = user.EmailAddress,
- Packages = packages,
- TotalPackageDownloadCount = packages.Sum(p => p.TotalDownloadCount)
- };
+ {
+ Username = user.Username,
+ EmailAddress = user.EmailAddress,
+ Packages = packages,
+ TotalPackageDownloadCount = packages.Sum(p => p.TotalDownloadCount)
+ };
return View(model);
}
2  Website/DataServices/CountInterceptor.cs
View
@@ -16,7 +16,7 @@ public CountInterceptor(long count)
protected override Expression VisitMethodCall(MethodCallExpression node)
{
var method = node.Method;
- if ((method.DeclaringType == typeof (Queryable)) && method.Name.Equals("LongCount", StringComparison.Ordinal))
+ if ((method.DeclaringType == typeof(Queryable)) && method.Name.Equals("LongCount", StringComparison.Ordinal))
{
return Expression.Constant(_count);
}
2  Website/DataServices/DisregardODataInterceptor.cs
View
@@ -12,7 +12,7 @@ protected override Expression VisitMethodCall(MethodCallExpression node)
var methodsToIgnore = new HashSet<string>(
new[] { "Skip", "OrderBy", "ThenBy", "OrderByDescending", "ThenByDescending" }, StringComparer.Ordinal);
var method = node.Method;
- if ((method.DeclaringType == typeof (Queryable)) && methodsToIgnore.Contains(method.Name))
+ if ((method.DeclaringType == typeof(Queryable)) && methodsToIgnore.Contains(method.Name))
{
// The expression is of the format Queryable.OrderBy(<Expression>, <Order-by-params>). To avoid performing the
// method, we ignore it, traversing the passed in expression instead.
22 Website/DataServices/FeedServiceBase.cs
View
@@ -144,7 +144,7 @@ public int StreamBufferSize
public object GetService(Type serviceType)
{
- if (serviceType == typeof (IDataServiceStreamProvider))
+ if (serviceType == typeof(IDataServiceStreamProvider))
{
return this;
}
@@ -207,16 +207,16 @@ private bool TryReadSearchFilter(HttpRequestBase request, out SearchFilter searc
var keywordPath = odataQuery.Path as KeywordSegmentQueryToken;
searchFilter = new SearchFilter
- {
- // HACK: The way the default paging works is WCF attempts to read up to the MaxPageSize elements. If it finds as many, it'll assume there
- // are more elements to be paged and generate a continuation link. Consequently we'll always ask to pull MaxPageSize elements so WCF generates the
- // link for us and then allow it to do a Take on the results. The alternative to do is roll our IDataServicePagingProvider, but we run into
- // issues since we need to manage state over concurrent requests. This seems like an easier solution.
- Take = MaxPageSize,
- Skip = odataQuery.Skip ?? 0,
- CountOnly = keywordPath != null && keywordPath.Keyword == KeywordKind.Count,
- SortDirection = SortDirection.Ascending
- };
+ {
+ // HACK: The way the default paging works is WCF attempts to read up to the MaxPageSize elements. If it finds as many, it'll assume there
+ // are more elements to be paged and generate a continuation link. Consequently we'll always ask to pull MaxPageSize elements so WCF generates the
+ // link for us and then allow it to do a Take on the results. The alternative to do is roll our IDataServicePagingProvider, but we run into
+ // issues since we need to manage state over concurrent requests. This seems like an easier solution.
+ Take = MaxPageSize,
+ Skip = odataQuery.Skip ?? 0,
+ CountOnly = keywordPath != null && keywordPath.Keyword == KeywordKind.Count,
+ SortDirection = SortDirection.Ascending
+ };
var filterProperty = odataQuery.Filter as PropertyAccessQueryToken;
if (filterProperty == null ||
2  Website/DataServices/ODataRemoveVersionSorter.cs
View
@@ -22,7 +22,7 @@ private bool IsSortingOnVersion(MethodCallExpression expression)
var methodsToIgnore = new[] { "ThenBy", "ThenByDescending" };
var method = expression.Method;
- if (method.DeclaringType == typeof (Queryable) && methodsToIgnore.Contains(method.Name, StringComparer.Ordinal))
+ if (method.DeclaringType == typeof(Queryable) && methodsToIgnore.Contains(method.Name, StringComparer.Ordinal))
{
return IsVersionArgument(expression);
}
124 Website/DataServices/PackageExtensions.cs
View
@@ -18,37 +18,37 @@ public static IQueryable<V1FeedPackage> ToV1FeedPackageQuery(this IQueryable<Pac
.WithoutNullPropagation()
.Select(
p => new V1FeedPackage
- {
- Id = p.PackageRegistration.Id,
- Version = p.Version,
- Authors = p.FlattenedAuthors,
- Copyright = p.Copyright,
- Created = p.Created,
- Dependencies = p.FlattenedDependencies,
- Description = p.Description,
- DownloadCount = p.PackageRegistration.DownloadCount,
- ExternalPackageUrl = p.ExternalPackageUrl,
- GalleryDetailsUrl = siteRoot + "packages/" + p.PackageRegistration.Id + "/" + p.Version,
- IconUrl = p.IconUrl,
- IsLatestVersion = p.IsLatestStable,
- Language = p.Language,
- LastUpdated = p.LastUpdated,
- LicenseUrl = p.LicenseUrl,
- PackageHash = p.Hash,
- PackageHashAlgorithm = p.HashAlgorithm,
- PackageSize = p.PackageFileSize,
- ProjectUrl = p.ProjectUrl,
- Published = p.Listed ? p.Published : UnpublishedDate,
- ReleaseNotes = p.ReleaseNotes,
- ReportAbuseUrl = siteRoot + "package/ReportAbuse/" + p.PackageRegistration.Id + "/" + p.Version,
- RequireLicenseAcceptance = p.RequiresLicenseAcceptance,
- Summary = p.Summary,
- Tags = p.Tags == null ? null : " " + p.Tags.Trim() + " ",
- // In the current feed, tags are padded with a single leading and trailing space
- Title = p.Title ?? p.PackageRegistration.Id, // Need to do this since the older feed always showed a title.
- VersionDownloadCount = p.DownloadCount,
- Rating = 0
- });
+ {
+ Id = p.PackageRegistration.Id,
+ Version = p.Version,
+ Authors = p.FlattenedAuthors,
+ Copyright = p.Copyright,
+ Created = p.Created,
+ Dependencies = p.FlattenedDependencies,
+ Description = p.Description,
+ DownloadCount = p.PackageRegistration.DownloadCount,
+ ExternalPackageUrl = p.ExternalPackageUrl,
+ GalleryDetailsUrl = siteRoot + "packages/" + p.PackageRegistration.Id + "/" + p.Version,
+ IconUrl = p.IconUrl,
+ IsLatestVersion = p.IsLatestStable,
+ Language = p.Language,
+ LastUpdated = p.LastUpdated,
+ LicenseUrl = p.LicenseUrl,
+ PackageHash = p.Hash,
+ PackageHashAlgorithm = p.HashAlgorithm,
+ PackageSize = p.PackageFileSize,
+ ProjectUrl = p.ProjectUrl,
+ Published = p.Listed ? p.Published : UnpublishedDate,
+ ReleaseNotes = p.ReleaseNotes,
+ ReportAbuseUrl = siteRoot + "package/ReportAbuse/" + p.PackageRegistration.Id + "/" + p.Version,
+ RequireLicenseAcceptance = p.RequiresLicenseAcceptance,
+ Summary = p.Summary,
+ Tags = p.Tags == null ? null : " " + p.Tags.Trim() + " ",
+ // In the current feed, tags are padded with a single leading and trailing space
+ Title = p.Title ?? p.PackageRegistration.Id, // Need to do this since the older feed always showed a title.
+ VersionDownloadCount = p.DownloadCount,
+ Rating = 0
+ });
}
public static IQueryable<V2FeedPackage> ToV2FeedPackageQuery(this IQueryable<Package> packages, string siteRoot)
@@ -59,37 +59,37 @@ public static IQueryable<V2FeedPackage> ToV2FeedPackageQuery(this IQueryable<Pac
.WithoutNullPropagation()
.Select(
p => new V2FeedPackage
- {
- Id = p.PackageRegistration.Id,
- Version = p.Version,
- Authors = p.FlattenedAuthors,
- Copyright = p.Copyright,
- Created = p.Created,
- Dependencies = p.FlattenedDependencies,
- Description = p.Description,
- DownloadCount = p.PackageRegistration.DownloadCount,
- GalleryDetailsUrl = siteRoot + "packages/" + p.PackageRegistration.Id + "/" + p.Version,
- IconUrl = p.IconUrl,
- IsLatestVersion = p.IsLatestStable,
- // To maintain parity with v1 behavior of the feed, IsLatestVersion would only be used for stable versions.
- IsAbsoluteLatestVersion = p.IsLatest,
- IsPrerelease = p.IsPrerelease,
- LastUpdated = p.LastUpdated,
- LicenseUrl = p.LicenseUrl,
- Language = p.Language,
- PackageHash = p.Hash,
- PackageHashAlgorithm = p.HashAlgorithm,
- PackageSize = p.PackageFileSize,
- ProjectUrl = p.ProjectUrl,
- ReleaseNotes = p.ReleaseNotes,
- ReportAbuseUrl = siteRoot + "package/ReportAbuse/" + p.PackageRegistration.Id + "/" + p.Version,
- RequireLicenseAcceptance = p.RequiresLicenseAcceptance,
- Published = p.Listed ? p.Published : UnpublishedDate,
- Summary = p.Summary,
- Tags = p.Tags,
- Title = p.Title,
- VersionDownloadCount = p.DownloadCount
- });
+ {
+ Id = p.PackageRegistration.Id,
+ Version = p.Version,
+ Authors = p.FlattenedAuthors,
+ Copyright = p.Copyright,
+ Created = p.Created,
+ Dependencies = p.FlattenedDependencies,
+ Description = p.Description,
+ DownloadCount = p.PackageRegistration.DownloadCount,
+ GalleryDetailsUrl = siteRoot + "packages/" + p.PackageRegistration.Id + "/" + p.Version,
+ IconUrl = p.IconUrl,
+ IsLatestVersion = p.IsLatestStable,
+ // To maintain parity with v1 behavior of the feed, IsLatestVersion would only be used for stable versions.
+ IsAbsoluteLatestVersion = p.IsLatest,
+ IsPrerelease = p.IsPrerelease,
+ LastUpdated = p.LastUpdated,
+ LicenseUrl = p.LicenseUrl,
+ Language = p.Language,
+ PackageHash = p.Hash,
+ PackageHashAlgorithm = p.HashAlgorithm,
+ PackageSize = p.PackageFileSize,
+ ProjectUrl = p.ProjectUrl,
+ ReleaseNotes = p.ReleaseNotes,
+ ReportAbuseUrl = siteRoot + "package/ReportAbuse/" + p.PackageRegistration.Id + "/" + p.Version,
+ RequireLicenseAcceptance = p.RequiresLicenseAcceptance,
+ Published = p.Listed ? p.Published : UnpublishedDate,
+ Summary = p.Summary,
+ Tags = p.Tags,
+ Title = p.Title,
+ VersionDownloadCount = p.DownloadCount
+ });
}
internal static IQueryable<TVal> WithoutVersionSort<TVal>(this IQueryable<TVal> feedQuery)
12 Website/DataServices/V1Feed.svc.cs
View
@@ -29,12 +29,12 @@ public static void InitializeService(DataServiceConfiguration config)
protected override FeedContext<V1FeedPackage> CreateDataSource()
{
return new FeedContext<V1FeedPackage>
- {
- Packages = PackageRepo.GetAll()
- .Where(p => !p.IsPrerelease)
- .WithoutVersionSort()
- .ToV1FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))
- };
+ {
+ Packages = PackageRepo.GetAll()
+ .Where(p => !p.IsPrerelease)
+ .WithoutVersionSort()
+ .ToV1FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))
+ };
}
public override Uri GetReadStreamUri(
6 Website/DataServices/V2CuratedFeed.svc.cs
View
@@ -28,9 +28,9 @@ protected override FeedContext<V2FeedPackage> CreateDataSource()
var packages = GetPackages();
return new FeedContext<V2FeedPackage>
- {
- Packages = packages.ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))
- };
+ {
+ Packages = packages.ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))
+ };
}
public static void InitializeService(DataServiceConfiguration config)
10 Website/DataServices/V2Feed.svc.cs
View
@@ -27,11 +27,11 @@ public V2Feed(IEntitiesContext entities, IEntityRepository<Package> repo, IConfi
protected override FeedContext<V2FeedPackage> CreateDataSource()
{
return new FeedContext<V2FeedPackage>
- {
- Packages = PackageRepo.GetAll()
- .WithoutVersionSort()
- .ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))
- };
+ {
+ Packages = PackageRepo.GetAll()
+ .WithoutVersionSort()
+ .ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))
+ };
}
public static void InitializeService(DataServiceConfiguration config)
2  Website/DynamicData/FieldTemplates/DateTime_Edit.ascx.cs
View
@@ -41,7 +41,7 @@ private void SetUpCustomValidator(CustomValidator validator)
break;
}
}
- else if (Column.ColumnType == typeof (DateTime))
+ else if (Column.ColumnType == typeof(DateTime))
{
validator.Enabled = true;
DateValidator.ErrorMessage = HttpUtility.HtmlEncode(DefaultDateAttribute.FormatErrorMessage(Column.DisplayName));
2  Website/DynamicData/Filters/Boolean.ascx.cs
View
@@ -18,7 +18,7 @@ public override Control FilterControl
protected void Page_Init(object sender, EventArgs e)
{
- if (!(Column.ColumnType == typeof (bool)))
+ if (!(Column.ColumnType == typeof(bool)))
{
throw new InvalidOperationException(
String.Format(
2  Website/ExtensionMethods.cs
View
@@ -211,7 +211,7 @@ public static IQueryable<T> SortBy<T>(this IQueryable<T> source, string sortExpr
string methodName = descIndex == -1 ? "OrderBy" : "OrderByDescending";
Expression methodCallExpression = Expression.Call(
- typeof (Queryable),
+ typeof(Queryable),
methodName,
new[]
{
164 Website/Migrations/201110060711357_Initial.cs
View
@@ -9,31 +9,31 @@ public override void Up()
CreateTable(
"Users",
c => new
- {
- Key = c.Int(nullable: false, identity: true),
- ApiKey = c.Guid(nullable: false),
- EmailAddress = c.String(),
- UnconfirmedEmailAddress = c.String(),
- HashedPassword = c.String(),
- Username = c.String(),
- EmailAllowed = c.Boolean(nullable: false),
- EmailConfirmationToken = c.String(),
- PasswordResetToken = c.String(),
- PasswordResetTokenExpirationDate = c.DateTime(),
- })
+ {
+ Key = c.Int(nullable: false, identity: true),
+ ApiKey = c.Guid(nullable: false),
+ EmailAddress = c.String(),
+ UnconfirmedEmailAddress = c.String(),
+ HashedPassword = c.String(),
+ Username = c.String(),
+ EmailAllowed = c.Boolean(nullable: false),
+ EmailConfirmationToken = c.String(),
+ PasswordResetToken = c.String(),
+ PasswordResetTokenExpirationDate = c.DateTime(),
+ })
.PrimaryKey(t => t.Key);
CreateTable(
"EmailMessages",
c => new
- {
- Key = c.Int(nullable: false, identity: true),
- Body = c.String(),
- FromUserKey = c.Int(),
- Sent = c.Boolean(nullable: false),
- Subject = c.String(),
- ToUserKey = c.Int(nullable: false),
- })
+ {
+ Key = c.Int(nullable: false, identity: true),
+ Body = c.String(),
+ FromUserKey = c.Int(),
+ Sent = c.Boolean(nullable: false),
+ Subject = c.String(),
+ ToUserKey = c.Int(nullable: false),
+ })
.PrimaryKey(t => t.Key)
.ForeignKey("Users", t => t.FromUserKey)
.ForeignKey("Users", t => t.ToUserKey);
@@ -41,98 +41,98 @@ public override void Up()
CreateTable(
"Roles",
c => new
- {
- Key = c.Int(nullable: false, identity: true),
- Name = c.String(),
- })
+ {