Permalink
Browse files

Updating formatting to VS defaults

  • Loading branch information...
1 parent 0ad6426 commit 6ab722347795bc91fcf439ec1c370700b6186fed pranavkm committed Oct 14, 2011
Showing with 7,433 additions and 6,458 deletions.
  1. +46 −23 Facts/Controllers/ApiControllerFacts.cs
  2. +34 −17 Facts/Controllers/AuthenticationControllerFacts.cs
  3. +48 −24 Facts/Controllers/PackagesControllerFacts.cs
  4. +82 −41 Facts/Controllers/UsersControllerFacts.cs
  5. +18 −9 Facts/Infrastructure/CookieTempDataProviderFacts.cs
  6. +56 −28 Facts/Services/CloudBlobPackageFileServiceFacts.cs
  7. +49 −26 Facts/Services/FileSystemPackageFileServiceFacts.cs
  8. +26 −13 Facts/Services/MessageServiceFacts.cs
  9. +186 −94 Facts/Services/PackageServiceFacts.cs
  10. +98 −49 Facts/Services/UsersServiceFacts.cs
  11. +6 −3 Facts/TestUtility.cs
  12. +12 −6 Facts/ViewModels/PreviousNextPagerViewModel.cs
  13. +4 −2 Website/ActionNames.cs
  14. +25 −22 Website/ApiController.generated.cs
  15. +16 −8 Website/App_Start/AuthenticationModule.cs
  16. +8 −4 Website/App_Start/Bootstrapper.cs
  17. +64 −32 Website/App_Start/Configuration.cs
  18. +8 −4 Website/App_Start/Container.cs
  19. +20 −10 Website/App_Start/ContainerBindings.cs
  20. +4 −2 Website/App_Start/IConfiguration.cs
  21. +18 −9 Website/App_Start/MiniProfiler.cs
  22. +10 −5 Website/App_Start/NinjectMVC3.cs
  23. +5 −4 Website/App_Start/PackageStoreType.cs
  24. +6 −3 Website/App_Start/Routes.cs
  25. +13 −8 Website/App_Start/VersionRouteConstraint.cs
  26. +21 −20 Website/AuthenticationController.generated.cs
  27. +6 −3 Website/BuildTasks/UpdateDatabase.cs
  28. +4 −2 Website/Const.cs
  29. +16 −8 Website/Controllers/ApiController.cs
  30. +24 −12 Website/Controllers/AuthenticationController.cs
  31. +5 −7 Website/Controllers/ForgotPasswordViewModel.cs
  32. +32 −17 Website/Controllers/JsonApiController.cs
  33. +131 −66 Website/Controllers/PackagesController.cs
  34. +10 −5 Website/Controllers/PagesController.cs
  35. +97 −50 Website/Controllers/UsersController.cs
  36. +6 −3 Website/DataServices/FeedContext.cs
  37. +32 −16 Website/DataServices/FeedServiceBase.cs
  38. +16 −9 Website/DataServices/PackageExtensions.cs
  39. +4 −2 Website/DataServices/V1FeedPackage.cs
  40. +14 −8 Website/DataServices/V1Feeds.svc.cs
  41. +8 −4 Website/DataServices/V2Feed.svc.cs
  42. +4 −2 Website/DataServices/V2FeedPackage.cs
  43. +30 −17 Website/DynamicData/Content/GridViewPager.ascx.cs
  44. +4 −2 Website/DynamicData/Content/GridViewPager.ascx.designer.cs
  45. +8 −6 Website/DynamicData/Default.aspx.cs
  46. +8 −6 Website/DynamicData/Default.aspx.designer.cs
  47. +12 −9 Website/DynamicData/EntityTemplates/Default.ascx.cs
  48. +4 −2 Website/DynamicData/EntityTemplates/Default.ascx.designer.cs
  49. +16 −11 Website/DynamicData/EntityTemplates/Default_Edit.ascx.cs
  50. +4 −2 Website/DynamicData/EntityTemplates/Default_Edit.ascx.designer.cs
  51. +16 −11 Website/DynamicData/EntityTemplates/Default_Insert.ascx.cs
  52. +4 −2 Website/DynamicData/EntityTemplates/Default_Insert.ascx.designer.cs
  53. +10 −10 Website/DynamicData/FieldTemplates/Boolean.ascx.cs
  54. +4 −2 Website/DynamicData/FieldTemplates/Boolean.ascx.designer.cs
  55. +12 −10 Website/DynamicData/FieldTemplates/Boolean_Edit.ascx.cs
  56. +4 −2 Website/DynamicData/FieldTemplates/Boolean_Edit.ascx.designer.cs
  57. +30 −20 Website/DynamicData/FieldTemplates/Children.ascx.cs
  58. +4 −2 Website/DynamicData/FieldTemplates/Children.ascx.designer.cs
  59. +5 −10 Website/DynamicData/FieldTemplates/Children_Insert.ascx.cs
  60. +4 −2 Website/DynamicData/FieldTemplates/Children_Insert.ascx.designer.cs
  61. +9 −11 Website/DynamicData/FieldTemplates/DateTime.ascx.cs
  62. +4 −2 Website/DynamicData/FieldTemplates/DateTime.ascx.designer.cs
  63. +22 −12 Website/DynamicData/FieldTemplates/DateTime_Edit.ascx.cs
  64. +4 −2 Website/DynamicData/FieldTemplates/DateTime_Edit.ascx.designer.cs
  65. +12 −10 Website/DynamicData/FieldTemplates/Decimal_Edit.ascx.cs
  66. +4 −2 Website/DynamicData/FieldTemplates/Decimal_Edit.ascx.designer.cs
  67. +12 −11 Website/DynamicData/FieldTemplates/EmailAddress.ascx.cs
  68. +4 −2 Website/DynamicData/FieldTemplates/EmailAddress.ascx.designer.cs
  69. +16 −12 Website/DynamicData/FieldTemplates/Enumeration.ascx.cs
  70. +4 −2 Website/DynamicData/FieldTemplates/Enumeration.ascx.designer.cs
  71. +30 −17 Website/DynamicData/FieldTemplates/Enumeration_Edit.ascx.cs
  72. +4 −2 Website/DynamicData/FieldTemplates/Enumeration_Edit.ascx.designer.cs
  73. +30 −20 Website/DynamicData/FieldTemplates/ForeignKey.ascx.cs
  74. +4 −2 Website/DynamicData/FieldTemplates/ForeignKey.ascx.designer.cs
  75. +22 −14 Website/DynamicData/FieldTemplates/ForeignKey_Edit.ascx.cs
  76. +4 −2 Website/DynamicData/FieldTemplates/ForeignKey_Edit.ascx.designer.cs
  77. +12 −10 Website/DynamicData/FieldTemplates/Integer_Edit.ascx.cs
  78. +4 −2 Website/DynamicData/FieldTemplates/Integer_Edit.ascx.designer.cs
  79. +14 −7 Website/DynamicData/FieldTemplates/ManyToMany.ascx.cs
  80. +4 −2 Website/DynamicData/FieldTemplates/ManyToMany.ascx.designer.cs
  81. +34 −17 Website/DynamicData/FieldTemplates/ManyToMany_Edit.ascx.cs
  82. +4 −2 Website/DynamicData/FieldTemplates/ManyToMany_Edit.ascx.designer.cs
  83. +12 −10 Website/DynamicData/FieldTemplates/MultilineText_Edit.ascx.cs
  84. +4 −2 Website/DynamicData/FieldTemplates/MultilineText_Edit.ascx.designer.cs
  85. +17 −14 Website/DynamicData/FieldTemplates/Text.ascx.cs
  86. +4 −2 Website/DynamicData/FieldTemplates/Text.ascx.designer.cs
  87. +18 −13 Website/DynamicData/FieldTemplates/Text_Edit.ascx.cs
  88. +4 −2 Website/DynamicData/FieldTemplates/Text_Edit.ascx.designer.cs
  89. +14 −12 Website/DynamicData/FieldTemplates/Url.ascx.cs
  90. +4 −2 Website/DynamicData/FieldTemplates/Url.ascx.designer.cs
  91. +28 −20 Website/DynamicData/Filters/Boolean.ascx.cs
  92. +4 −2 Website/DynamicData/Filters/Boolean.ascx.designer.cs
  93. +26 −19 Website/DynamicData/Filters/Enumeration.ascx.cs
  94. +4 −2 Website/DynamicData/Filters/Enumeration.ascx.designer.cs
  95. +32 −20 Website/DynamicData/Filters/ForeignKey.ascx.cs
  96. +4 −2 Website/DynamicData/Filters/ForeignKey.ascx.designer.cs
  97. +12 −11 Website/DynamicData/PageTemplates/Details.aspx.cs
  98. +14 −12 Website/DynamicData/PageTemplates/Details.aspx.designer.cs
  99. +16 −13 Website/DynamicData/PageTemplates/Edit.aspx.cs
  100. +13 −11 Website/DynamicData/PageTemplates/Edit.aspx.designer.cs
  101. +16 −13 Website/DynamicData/PageTemplates/Insert.aspx.cs
  102. +12 −10 Website/DynamicData/PageTemplates/Insert.aspx.designer.cs
  103. +19 −13 Website/DynamicData/PageTemplates/List.aspx.cs
  104. +16 −14 Website/DynamicData/PageTemplates/List.aspx.designer.cs
  105. +14 −8 Website/DynamicData/Registration.cs
  106. +5 −6 Website/DynamicData/Site.master.cs
  107. +10 −8 Website/DynamicData/Site.master.designer.cs
  108. +8 −4 Website/Entities/EmailMessage.cs
  109. +9 −9 Website/Entities/EntitiesContext.cs
  110. +8 −4 Website/Entities/EntityException.cs
  111. +16 −8 Website/Entities/EntityRepository.cs
  112. +4 −2 Website/Entities/IEntity.cs
  113. +4 −2 Website/Entities/IEntityRepository.cs
  114. +6 −3 Website/Entities/Package.cs
  115. +4 −2 Website/Entities/PackageAuthor.cs
  116. +4 −2 Website/Entities/PackageDependency.cs
  117. +6 −3 Website/Entities/PackageRegistration.cs
  118. +4 −2 Website/Entities/PackageStatistics.cs
  119. +4 −2 Website/Entities/Role.cs
  120. +16 −8 Website/Entities/User.cs
  121. +62 −31 Website/ExtensionMethods.cs
  122. +7 −15 Website/HelpersController.generated.cs
  123. +34 −18 Website/Infrastructure/CookieTempDataProvider.cs
  124. +14 −7 Website/Infrastructure/HintAttribute.cs
  125. +6 −3 Website/Infrastructure/NuGetControllerFactory.cs
  126. +13 −16 Website/JsonApiController.generated.cs
  127. +3 −3 Website/Migrations/201110060711357_Initial.Designer.cs
  128. +12 −12 Website/Migrations/201110060711357_Initial.cs
  129. +3 −3 Website/Migrations/201110102157002_PrereleaseChanges.Designer.cs
  130. +3 −4 Website/Migrations/201110102157002_PrereleaseChanges.cs
  131. +67 −43 Website/PackagesController.generated.cs
  132. +19 −19 Website/PagesController.generated.cs
  133. +1 −1 Website/Properties/AssemblyInfo.cs
  134. +4 −2 Website/RequestModels/DisplayPackageRequest.cs
  135. +4 −2 Website/RequestModels/RegisterRequest.cs
  136. +4 −2 Website/RequestModels/SignInRequest.cs
  137. +4 −3 Website/RequestModels/SubmitPackageRequest.cs
  138. +4 −2 Website/RouteNames.cs
  139. +8 −4 Website/Services/CloudBlobClientWrapper.cs
  140. +12 −6 Website/Services/CloudBlobContainerWrapper.cs
  141. +16 −8 Website/Services/CloudBlobPackageFileService.cs
  142. +12 −6 Website/Services/CloudBlobWrapper.cs
  143. +20 −10 Website/Services/CryptographyService.cs
  144. +19 −10 Website/Services/Extensions.cs
  145. +18 −9 Website/Services/FileSystemPackageFileService.cs
  146. +10 −5 Website/Services/FileSystemService.cs
  147. +10 −5 Website/Services/FormsAuthenticationService.cs
  148. +4 −2 Website/Services/ICloudBlob.cs
  149. +4 −2 Website/Services/ICloudBlobClient.cs
  150. +4 −2 Website/Services/ICloudBlobContainer.cs
  151. +4 −2 Website/Services/ICryptographyService.cs
  152. +4 −2 Website/Services/IFileSystemService.cs
  153. +4 −2 Website/Services/IFormsAuthenticationService.cs
  154. +4 −2 Website/Services/IMessageService.cs
  155. +4 −2 Website/Services/IPackageFileService.cs
  156. +4 −2 Website/Services/IPackageService.cs
  157. +4 −2 Website/Services/IUserService.cs
  158. +36 −18 Website/Services/MessageService.cs
  159. +94 −48 Website/Services/PackageService.cs
  160. +66 −33 Website/Services/UserService.cs
  161. +9 −16 Website/SharedController.generated.cs
  162. +75 −47 Website/Strings.Designer.cs
  163. +155 −94 Website/T4MVC.cs
  164. +44 −22 Website/UrlExtensions.cs
  165. +53 −36 Website/UsersController.generated.cs
  166. +4 −2 Website/ViewModels/ContactOwnersViewModel.cs
  167. +6 −3 Website/ViewModels/DeletePackageViewModel.cs
  168. +10 −5 Website/ViewModels/DependencyViewModel.cs
  169. +10 −5 Website/ViewModels/DisplayPackageViewModel.cs
  170. +4 −2 Website/ViewModels/EditProfileViewModel.cs
  171. +4 −2 Website/ViewModels/EmailConfirmationModel.cs
  172. +4 −2 Website/ViewModels/IPackageVersionModel.cs
  173. +4 −2 Website/ViewModels/IPageableEnumerable.cs
  174. +4 −2 Website/ViewModels/IPreviousNextPager.cs
  175. +14 −7 Website/ViewModels/ListPackageItemViewModel.cs
  176. +10 −5 Website/ViewModels/ManagePackageOwnersViewModel.cs
  177. +4 −2 Website/ViewModels/ManagePackagesViewModel.cs
  178. +14 −9 Website/ViewModels/PackageListViewModel.cs
  179. +20 −10 Website/ViewModels/PackageViewModel.cs
  180. +4 −2 Website/ViewModels/PasswordChangeViewModel.cs
  181. +4 −2 Website/ViewModels/PasswordResetRequestViewModel.cs
  182. +4 −2 Website/ViewModels/PasswordResetViewModel.cs
  183. +6 −4 Website/ViewModels/PreviousNextPagerViewModel.cs
  184. +4 −2 Website/ViewModels/ReportAbuseViewModel.cs
  185. +5 −3 Website/ViewModels/SubmitPackageViewModel.cs
  186. +4 −2 Website/ViewModels/UserProfileModel.cs
  187. +159 −167 Website/Views/Authentication/LogOn.generated.cs
  188. +154 −140 Website/Views/Helpers/ViewHelpers.generated.cs
  189. +150 −158 Website/Views/Packages/ContactOwners.generated.cs
  190. +166 −175 Website/Views/Packages/Delete.generated.cs
  191. +499 −494 Website/Views/Packages/DisplayPackage.generated.cs
  192. +65 −78 Website/Views/Packages/Edit.generated.cs
  193. +1 −1 Website/Views/Packages/ListPackages.generated.cs
  194. +82 −98 Website/Views/Packages/ManagePackageOwners.generated.cs
  195. +210 −216 Website/Views/Packages/PublishPackage.generated.cs
  196. +189 −195 Website/Views/Packages/ReportAbuse.generated.cs
  197. +63 −75 Website/Views/Packages/UploadPackage.generated.cs
  198. +179 −190 Website/Views/Packages/_ListPackage.generated.cs
  199. +98 −111 Website/Views/Packages/_PackageDetailsTable.generated.cs
  200. +50 −67 Website/Views/Pages/Home.generated.cs
  201. +172 −189 Website/Views/Pages/Privacy.generated.cs
  202. +233 −250 Website/Views/Pages/Terms.generated.cs
  203. +108 −123 Website/Views/Shared/EditorTemplates/Object.generated.cs
  204. +11 −28 Website/Views/Shared/Error.generated.cs
  205. +227 −239 Website/Views/Shared/Layout.generated.cs
  206. +40 −57 Website/Views/Shared/TwoColumnLayout.generated.cs
  207. +62 −76 Website/Views/Shared/UserDisplay.generated.cs
  208. +25 −41 Website/Views/Shared/_searchbox.generated.cs
  209. +106 −118 Website/Views/Users/Account.generated.cs
  210. +95 −106 Website/Views/Users/ChangePassword.generated.cs
  211. +108 −116 Website/Views/Users/Confirm.generated.cs
  212. +198 −205 Website/Views/Users/Edit.generated.cs
  213. +90 −102 Website/Views/Users/ForgotPassword.generated.cs
  214. +117 −125 Website/Views/Users/Packages.generated.cs
  215. +33 −47 Website/Views/Users/PasswordChanged.generated.cs
  216. +75 −87 Website/Views/Users/PasswordSent.generated.cs
  217. +114 −128 Website/Views/Users/Profiles.generated.cs
  218. +97 −109 Website/Views/Users/Register.generated.cs
  219. +115 −125 Website/Views/Users/ResetPassword.generated.cs
  220. +95 −103 Website/Views/Users/Thanks.generated.cs
@@ -3,11 +3,15 @@
using NuGet;
using Xunit;
-namespace NuGetGallery {
- public class ApiControllerFacts {
- public class TheCreatePackageAction {
+namespace NuGetGallery
+{
+ public class ApiControllerFacts
+ {
+ public class TheCreatePackageAction
+ {
[Fact]
- public void WillThrowIfTheApiKeyDoesNotExist() {
+ public void WillThrowIfTheApiKeyDoesNotExist()
+ {
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByApiKey(It.IsAny<Guid>())).Returns((User)null);
var controller = CreateController(userSvc: userSvc);
@@ -18,7 +22,8 @@ public class TheCreatePackageAction {
}
[Fact]
- public void WillThrowIfAPackageWithTheIdAndSemanticVersionAlreadyExists() {
+ public void WillThrowIfAPackageWithTheIdAndSemanticVersionAlreadyExists()
+ {
var nuGetPackage = new Mock<IPackage>();
nuGetPackage.Setup(x => x.Id).Returns("theId");
nuGetPackage.Setup(x => x.Version).Returns(new SemanticVersion("1.0.42"));
@@ -34,7 +39,8 @@ public class TheCreatePackageAction {
}
[Fact]
- public void WillFindTheUserThatMatchesTheApiKey() {
+ public void WillFindTheUserThatMatchesTheApiKey()
+ {
var nuGetPackage = new Mock<IPackage>();
nuGetPackage.Setup(x => x.Id).Returns("theId");
nuGetPackage.Setup(x => x.Version).Returns(new SemanticVersion("1.0.42"));
@@ -50,7 +56,8 @@ public class TheCreatePackageAction {
}
[Fact]
- public void WillCreateAPackageFromTheNuGetPackage() {
+ public void WillCreateAPackageFromTheNuGetPackage()
+ {
var nuGetPackage = new Mock<IPackage>();
nuGetPackage.Setup(x => x.Id).Returns("theId");
nuGetPackage.Setup(x => x.Version).Returns(new SemanticVersion("1.0.42"));
@@ -65,7 +72,8 @@ public class TheCreatePackageAction {
}
[Fact]
- public void WillCreateAPackageWithTheUserMatchingTheApiKey() {
+ public void WillCreateAPackageWithTheUserMatchingTheApiKey()
+ {
var nuGetPackage = new Mock<IPackage>();
nuGetPackage.Setup(x => x.Id).Returns("theId");
nuGetPackage.Setup(x => x.Version).Returns(new SemanticVersion("1.0.42"));
@@ -81,9 +89,11 @@ public class TheCreatePackageAction {
}
}
- public class TheDeletePackageAction {
+ public class TheDeletePackageAction
+ {
[Fact]
- public void WillThrowIfTheApiKeyDoesNotExist() {
+ public void WillThrowIfTheApiKeyDoesNotExist()
+ {
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByApiKey(It.IsAny<Guid>())).Returns((User)null);
var controller = CreateController(userSvc: userSvc);
@@ -94,7 +104,8 @@ public class TheDeletePackageAction {
}
[Fact]
- public void WillThrowIfAPackageWithTheIdAndSemanticVersionDoesNotExist() {
+ public void WillThrowIfAPackageWithTheIdAndSemanticVersionDoesNotExist()
+ {
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns((Package)null);
var userSvc = new Mock<IUserService>();
@@ -107,9 +118,11 @@ public class TheDeletePackageAction {
}
[Fact]
- public void WillFindTheUserThatMatchesTheApiKey() {
+ public void WillFindTheUserThatMatchesTheApiKey()
+ {
var owner = new User { Key = 1 };
- var package = new Package {
+ var package = new Package
+ {
PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
};
var packageSvc = new Mock<IPackageService>();
@@ -125,9 +138,11 @@ public class TheDeletePackageAction {
}
[Fact]
- public void WillNotDeleteThePackageIfApiKeyDoesNotBelongToAnOwner() {
+ public void WillNotDeleteThePackageIfApiKeyDoesNotBelongToAnOwner()
+ {
var owner = new User { Key = 1 };
- var package = new Package {
+ var package = new Package
+ {
PackageRegistration = new PackageRegistration { Owners = new[] { new User() } }
};
var packageSvc = new Mock<IPackageService>();
@@ -142,9 +157,11 @@ public class TheDeletePackageAction {
}
[Fact]
- public void WillDeleteThePackageIfApiKeyBelongsToAnOwner() {
+ public void WillDeleteThePackageIfApiKeyBelongsToAnOwner()
+ {
var owner = new User { Key = 1 };
- var package = new Package {
+ var package = new Package
+ {
PackageRegistration = new PackageRegistration { Owners = new[] { new User(), owner } }
};
var packageSvc = new Mock<IPackageService>();
@@ -160,9 +177,11 @@ public class TheDeletePackageAction {
}
}
- public class ThePublishPackageAction {
+ public class ThePublishPackageAction
+ {
[Fact]
- public void WillThrowIfTheApiKeyDoesNotExist() {
+ public void WillThrowIfTheApiKeyDoesNotExist()
+ {
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByApiKey(It.IsAny<Guid>())).Returns((User)null);
var controller = CreateController(userSvc: userSvc);
@@ -173,7 +192,8 @@ public class ThePublishPackageAction {
}
[Fact]
- public void WillThrowIfAPackageWithTheIdAndSemanticVersionDoesNotExist() {
+ public void WillThrowIfAPackageWithTheIdAndSemanticVersionDoesNotExist()
+ {
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns((Package)null);
var userSvc = new Mock<IUserService>();
@@ -186,7 +206,8 @@ public class ThePublishPackageAction {
}
[Fact]
- public void WillFindTheUserThatMatchesTheApiKey() {
+ public void WillFindTheUserThatMatchesTheApiKey()
+ {
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(new Package());
var userSvc = new Mock<IUserService>();
@@ -200,7 +221,8 @@ public class ThePublishPackageAction {
}
[Fact]
- public void WillPublishThePackage() {
+ public void WillPublishThePackage()
+ {
var packageSvc = new Mock<IPackageService>();
packageSvc.Setup(x => x.FindPackageByIdAndVersion(It.IsAny<string>(), It.IsAny<string>(), true)).Returns(new Package());
var userSvc = new Mock<IUserService>();
@@ -217,7 +239,8 @@ public class ThePublishPackageAction {
static ApiController CreateController(
Mock<IPackageService> packageSvc = null,
Mock<IUserService> userSvc = null,
- IPackage packageFromInputStream = null) {
+ IPackage packageFromInputStream = null)
+ {
packageSvc = packageSvc ?? new Mock<IPackageService>();
userSvc = userSvc ?? new Mock<IUserService>();
var controller = new Mock<ApiController>(packageSvc.Object, userSvc.Object);
@@ -5,11 +5,15 @@
using Moq;
using Xunit;
-namespace NuGetGallery.Controllers {
- public class AuthenticationControllerFacts {
- public class TheLogOnAction {
+namespace NuGetGallery.Controllers
+{
+ public class AuthenticationControllerFacts
+ {
+ public class TheLogOnAction
+ {
[Fact]
- public void WillShowTheViewWithErrorsIfTheModelStateIsInvalid() {
+ public void WillShowTheViewWithErrorsIfTheModelStateIsInvalid()
+ {
var controller = CreateController();
controller.ModelState.AddModelError(string.Empty, "aFakeError");
@@ -20,7 +24,8 @@ public class TheLogOnAction {
}
[Fact]
- public void WillLogTheUserOnWhenTheUsernameAndPasswordAreValidAndUserIsConfirmed() {
+ public void WillLogTheUserOnWhenTheUsernameAndPasswordAreValidAndUserIsConfirmed()
+ {
var formsAuthSvc = new Mock<IFormsAuthenticationService>();
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByUsernameAndPassword("theUsername", "thePassword"))
@@ -40,7 +45,8 @@ public class TheLogOnAction {
}
[Fact]
- public void WillNotLogTheUserOnWhenTheUsernameAndPasswordAreValidAndUserIsNotConfirmed() {
+ public void WillNotLogTheUserOnWhenTheUsernameAndPasswordAreValidAndUserIsNotConfirmed()
+ {
var formsAuthSvc = new Mock<IFormsAuthenticationService>();
formsAuthSvc.Setup(x => x.SetAuthCookie(It.IsAny<string>(), It.IsAny<bool>(), null)).Throws(new InvalidOperationException());
var userSvc = new Mock<IUserService>();
@@ -56,11 +62,13 @@ public class TheLogOnAction {
}
[Fact]
- public void WillLogTheUserOnWithRolesWhenTheUsernameAndPasswordAreValidAndUserIsConfirmed() {
+ public void WillLogTheUserOnWithRolesWhenTheUsernameAndPasswordAreValidAndUserIsConfirmed()
+ {
var formsAuthSvc = new Mock<IFormsAuthenticationService>();
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByUsernameAndPassword("theUsername", "thePassword"))
- .Returns(new User("theUsername", null) {
+ .Returns(new User("theUsername", null)
+ {
Roles = new[] { new Role { Name = "Administrators" } },
EmailAddress = "confirmed@example.com"
});
@@ -79,7 +87,8 @@ public class TheLogOnAction {
}
[Fact]
- public void WillInvalidateModelStateAndShowTheViewWithErrorsWhenTheUsernameAndPasswordAreNotValid() {
+ public void WillInvalidateModelStateAndShowTheViewWithErrorsWhenTheUsernameAndPasswordAreNotValid()
+ {
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByUsernameAndPassword(It.IsAny<string>(), It.IsAny<string>()))
.Returns((User)null);
@@ -94,13 +103,15 @@ public class TheLogOnAction {
}
[Fact]
- public void WillRedirectToTheReturnUrl() {
+ public void WillRedirectToTheReturnUrl()
+ {
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByUsernameAndPassword(It.IsAny<string>(), It.IsAny<string>()))
.Returns(new User("theUsername", null) { EmailAddress = "confirmed@example.com" });
var controller = CreateController(
userSvc: userSvc,
- setup: mock => {
+ setup: mock =>
+ {
mock.Setup(x => x.SafeRedirect("theReturnUrl"))
.Returns(new RedirectResult("aSafeRedirectUrl"));
});
@@ -112,9 +123,11 @@ public class TheLogOnAction {
}
}
- public class TheLogOffAction {
+ public class TheLogOffAction
+ {
[Fact]
- public void WillLogTheUserOff() {
+ public void WillLogTheUserOff()
+ {
var formsAuthSvc = new Mock<IFormsAuthenticationService>();
var controller = CreateController(formsAuthSvc: formsAuthSvc);
@@ -124,13 +137,15 @@ public class TheLogOffAction {
}
[Fact]
- public void WillRedirectToTheReturnUrl() {
+ public void WillRedirectToTheReturnUrl()
+ {
var userSvc = new Mock<IUserService>();
userSvc.Setup(x => x.FindByUsernameAndPassword(It.IsAny<string>(), It.IsAny<string>()))
.Returns(new User("theUsername", null));
var controller = CreateController(
userSvc: userSvc,
- setup: mock => {
+ setup: mock =>
+ {
mock.Setup(x => x.SafeRedirect("theReturnUrl"))
.Returns(new RedirectResult("aSafeRedirectUrl"));
});
@@ -145,7 +160,8 @@ public class TheLogOffAction {
static AuthenticationController CreateController(
Mock<IFormsAuthenticationService> formsAuthSvc = null,
Mock<IUserService> userSvc = null,
- Action<Mock<AuthenticationController>> setup = null) {
+ Action<Mock<AuthenticationController>> setup = null)
+ {
formsAuthSvc = formsAuthSvc ?? new Mock<IFormsAuthenticationService>();
userSvc = userSvc ?? new Mock<IUserService>();
@@ -157,7 +173,8 @@ public class TheLogOffAction {
if (setup != null)
setup(controller);
- else {
+ else
+ {
controller.Setup(x => x.SafeRedirect(It.IsAny<string>()))
.Returns(new RedirectResult("aRedirectUrl "));
}
Oops, something went wrong.

0 comments on commit 6ab7223

Please sign in to comment.