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.VisualStudio.TestTools.UnitTesting; | |
using Moq; | |
namespace TestDoubles.Examples.Mock | |
{ | |
[TestClass] | |
public class Player_Test | |
{ | |
[TestMethod] | |
public void Should_be_able_to_roll_die_wtih_max_face_value() |
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.VisualStudio.TestTools.UnitTesting; | |
using Moq; | |
namespace TestDoubles.Examples.Stub | |
{ | |
[TestClass] | |
public class Player_Test | |
{ | |
[TestMethod] | |
public void Should_be_able_to_roll_die_wtih_max_face_value() |
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.VisualStudio.TestTools.UnitTesting; | |
using Moq; | |
namespace TestDoubles.Examples.Dummy | |
{ | |
[TestClass] | |
public class Player_Test | |
{ | |
[TestMethod] | |
public void Should_be_able_to_roll_die_wtih_max_face_value() |
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
private void SetupControllerForTests(ApiController controller, string controllerName) | |
{ | |
var config = new HttpConfiguration(); | |
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/api/" + controllerName); | |
var route = config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}"); | |
var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", controllerName } }); | |
controller.ControllerContext = new HttpControllerContext(config, routeData, request); | |
controller.Request = request; | |
controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config; |
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
// Example of usage | |
[TestMethod] | |
[AspNetDevelopmentServer("WcfService", "Physical path to your WCF project")] | |
public void TestMethod1() | |
{ | |
ServiceClient target = new ServiceClient(); | |
Assert.IsTrue(WcfWebServiceHelper.TryUrlRedirection(target, TestContext, "WcfService")); | |
int value = 0; | |
string expected = "You entered: 0"; | |
string actual; |
NewerOlder