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
/// <reference path="../Scripts/typings/angularjs/angular.d.ts" /> | |
module App { | |
export class TestCtrl { | |
private startTime: string; | |
constructor(private $scope: ITestCtrlScope) { | |
this.startTime = new Date().toLocaleString(); | |
$scope.message = "Hello there at " + this.startTime; |
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 PutViaServer() | |
{ | |
// Arrange | |
var config = new HttpConfiguration(); | |
WebApiConfig.Register(config); | |
var server = new HttpServer(config); | |
var client = new HttpClient(server); | |
var book = new Book(); |
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 static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
config.Routes.MapHttpRoute( | |
name: "DefaultApi", | |
routeTemplate: "api/{controller}/{id}", | |
defaults: new { id = RouteParameter.Optional } | |
); |
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 GetWithAnUnknownIdShouldReturnNotFound() | |
{ | |
// Arrange | |
var controller = new BooksController() | |
{ | |
Request = new HttpRequestMessage() | |
{ | |
Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } | |
} |
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 TestingDelegatingHandler<T> : DelegatingHandler | |
{ | |
private Func<HttpRequestMessage, HttpResponseMessage> _httpResponseMessageFunc; | |
public TestingDelegatingHandler(T value) | |
: this(HttpStatusCode.OK, value) | |
{ } | |
public TestingDelegatingHandler(HttpStatusCode statusCode) |
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 (var engine = new V8ScriptEngine()) | |
{ | |
var settings = GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings; | |
var jsonBook = JsonConvert.SerializeObject(newBook, settings); | |
engine.Execute("var book = " + jsonBook); | |
var path = HttpContext.Current.Server.MapPath(@"~\App\ValidateBook.js"); | |
engine.Execute(File.ReadAllText(path)); | |
var result = engine.Evaluate("validateBook(book)") as string; |
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
var text = "Hello from script 1"; | |
setTimeout(function () { | |
console.log(text); | |
}, 1000); |
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
(function() { | |
var text = "Hello from script 1"; | |
setTimeout(function () { | |
console.log(text); | |
}, 1000); | |
}()); |
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.UITesting; | |
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace CodedUITestProject1 | |
{ | |
[CodedUITest] | |
public class CodedUIWithPageObjectModel | |
{ |
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 HomeController : Controller | |
{ | |
private readonly IRuntimeEnvironment _runtimeEnvironment; | |
public HomeController(IRuntimeEnvironment runtimeEnvironment) | |
{ | |
_runtimeEnvironment = runtimeEnvironment; | |
} | |
public IActionResult About() |
OlderNewer