forked from PureKrome/RavenOverflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- BugFix: Seeding questions now correctly creates the CreatedByUserId.
- Added Json question index and test fact. - Updated RavenDb to v606-U.
- Loading branch information
Showing
12 changed files
with
143 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Web.Mvc; | ||
using CuttingEdge.Conditions; | ||
using Moq; | ||
using Raven.Client; | ||
using RavenOverflow.Web.Controllers; | ||
using RavenOverflow.Web.Models.Authentication; | ||
|
||
namespace RavenOverflow.Tests | ||
{ | ||
public static class ControllerUtilities | ||
{ | ||
// Reference: http://nerddinnerbook.s3.amazonaws.com/Part12.htm | ||
// Yes .. Nerd Dinner to the rescue! and we come full circle... | ||
public static T HomeController<T>(IDocumentSession documentSession, | ||
string userId = null, | ||
string displayName = null, | ||
string[] roles = null) where T : AbstractController, new() | ||
{ | ||
Condition.Requires(documentSession); | ||
|
||
// Some fake Authentication stuff. | ||
var customIdentity = new CustomIdentity(userId, displayName); | ||
var customPrincipal = new CustomPrincipal(customIdentity, roles); | ||
|
||
var mockControllerContext = new Mock<ControllerContext>(); | ||
mockControllerContext.Setup(x => x.HttpContext.User).Returns(customPrincipal); | ||
|
||
var homeController = new T(documentSession) { ControllerContext = mockControllerContext.Object }; | ||
|
||
return homeController; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.