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
public ActionResult View(int id) | |
{ | |
var entity = LoadFromDatabase(id); | |
return AutoMap<ViewResult>(View(entity)); | |
} |
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
public ActionResult Login(string username, string password) { | |
if(username != “user” || password != “123”) { | |
ModelState.AddError(“username or password incorrect”); | |
return View(); | |
} | |
return new LoginResult(username); //I typically pass the actual user into the login result | |
} |
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
[TestMethod] | |
public void Login_Success() { | |
AuthenticationController controller = new AuthenticationController(); | |
ActionResult result = controller.Login(“user”, “123”); | |
Assert.IsTrue(result.GetType() == typeof(LoginResult)); | |
Assert.AreEqual(“user”, ((LoginResult)result).Username); | |
} |
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
public ActionResult Graph() { | |
var data = null; //todo load some data | |
return new PdfResult(data); | |
} |
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
using Microsoft.TeamFoundation.Client; | |
using Microsoft.TeamFoundation.Build.Client; | |
using Microsoft.TeamFoundation.Build.Workflow; | |
using Microsoft.TeamFoundation.Build.Workflow.Activities; | |
public void CreateBuildDefinition(string solutionFile) | |
{ | |
//todo pull from config | |
string dropLocation = @"\\tfsserver\builddrop"; |
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
using Microsoft.TeamFoundation.Framework.Server; | |
using Microsoft.TeamFoundation.Common; | |
using Microsoft.TeamFoundation.VersionControl.Client; | |
using Microsoft.TeamFoundation.Client; | |
public class BuildCreator : ISubscriber | |
{ | |
public string Name | |
{ |
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
ModelMetadataProviders.Current = DependencyResolver.Current.GetService<ConventionModelMetadataProvider>(); | |
ModelBinders.Binders.DefaultBinder = DependencyResolver.Current.GetService<AdvancedModelBinder>(); |
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
public class AreaCreatedSubscriber : ISubscriber | |
{ | |
public string Name | |
{ | |
get { return "Create Default Queries"; } | |
} | |
public SubscriberPriority Priority | |
{ | |
get { return SubscriberPriority.Normal; } |
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
public class CreateDefaultQueriesJob : ITeamFoundationJobExtension | |
{ | |
public TeamFoundationJobExecutionResult Run(TeamFoundationRequestContext requestContext, TeamFoundationJobDefinition jobDefinition, DateTime queueTime, out string resultMessage) | |
{ | |
resultMessage = ""; | |
try | |
{ | |
TeamFoundationLocationService service = requestContext.GetService<TeamFoundationLocationService>(); | |
Uri selfReferenceUri = service.GetSelfReferenceUri(requestContext, service.GetDefaultAccessMapping(requestContext)); | |
TfsTeamProjectCollection tfsTeamProjectCollection = new TfsTeamProjectCollection(selfReferenceUri); |
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
namespace Microsoft.TeamFoundation.Framework.Common | |
{ | |
public enum TeamFoundationJobResult | |
{ | |
None = -1, | |
Succeeded, | |
PartiallySucceeded, | |
Failed, | |
Stopped, | |
Killed, |