Permalink
Browse files

Fix a busted unit test and a code analysis violation.

  • Loading branch information...
1 parent d85df81 commit 2a407c2b61bc3d1f947564a5796ff97895a629e6 @TimLovellSmith TimLovellSmith committed Mar 25, 2013
@@ -448,15 +448,15 @@ public void SendsMessageToGalleryOwnerWithUserInfoWhenAuthenticated()
httpContext.Setup(h => h.Request.IsAuthenticated).Returns(true);
httpContext.Setup(h => h.User.Identity.Name).Returns("Frodo");
var userService = new Mock<IUserService>();
- userService.Setup(u => u.FindByUsername("Frodo")).Returns(new User { EmailAddress = "frodo@hobbiton.example.com", Username = "Frodo" });
+ userService.Setup(u => u.FindByUsername("Frodo")).Returns(new User { EmailAddress = "frodo@hobbiton.example.com", Username = "Frodo", Key = 1 });
var controller = CreateController(
packageService: packageService,
messageService: messageService,
userService: userService,
httpContext: httpContext);
var model = new ReportAbuseViewModel
{
- Message = "Mordor took my finger.",
+ Message = "Mordor took my finger",
Reason = "GollumWasThere",
};
@@ -320,17 +320,18 @@ public virtual ActionResult ReportAbuse(string id, string version, ReportAbuseVi
from = new MailAddress(reportForm.Email);
}
- _messageService.ReportAbuse(
- new ReportPackageRequest
- {
- AlreadyContactedOwners = reportForm.AlreadyContactedOwner,
- FromAddress = from,
- Message = reportForm.Message,
- Package = package,
- Reason = reportForm.Reason,
- RequestingUser = user,
- Url = Url
- });
+ var request = new ReportPackageRequest
+ {
+ AlreadyContactedOwners = reportForm.AlreadyContactedOwner,
+ FromAddress = from,
+ Message = reportForm.Message,
+ Package = package,
+ Reason = reportForm.Reason,
+ RequestingUser = user,
+ Url = Url
+ };
+ _messageService.ReportAbuse(request
+ );
TempData["Message"] = "Your abuse report has been sent to the gallery operators.";
return RedirectToAction(MVC.Packages.DisplayPackage(id, version));
@@ -57,7 +57,7 @@ internal string FillIn(string subject, IConfiguration config)
return ret.ToString();
}
- private string Escape(string s)
+ private static string Escape(string s)
{
return s.Replace("{", @"\{\");
}

0 comments on commit 2a407c2

Please sign in to comment.