This file contains hidden or 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 interface IWrapFile | |
{ | |
bool Exists(string path); | |
void WriteAllText(string path, string contents); | |
} |
This file contains hidden or 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 Scribe2 | |
{ | |
private IWrapFile fileService; | |
public Scribe2(IWrapFile file) | |
{ | |
fileService = file; | |
} | |
public void SaveMessage(string file, string data) |
This file contains hidden or 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 FileService : IWrapFile | |
{ | |
public bool Exists(string path) | |
{ | |
return File.Exists(path); | |
} | |
public void WriteAllText(string path, string contents) | |
{ | |
File.WriteAllText(path, contents); |
This file contains hidden or 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 Scribe | |
{ | |
public void SaveMessage(string file, string data) | |
{ | |
if (File.Exists( file )) // How do you test this code?? | |
{ | |
throw new Exception("File name must be unique"); | |
} | |
File.WriteAllText(path, data); |
This file contains hidden or 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
<script> | |
window.onerror = function (errorText, url, lineNumber) { | |
var report = { | |
errorText: errorText, | |
url: url, | |
lineNumber: lineNumber | |
}; | |
$.ajax({ | |
type: "POST", |
This file contains hidden or 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 ErrorController : Controller | |
{ | |
[HttpPost] | |
public JsonResult Record(ErrorInputModel model) | |
{ | |
var ex = new ClientErrorException(model.ToString()); | |
var signal = ErrorSignal.FromCurrentContext(); | |
signal.Raise(ex); |
This file contains hidden or 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 Extensions | |
{ | |
public static dynamic DefaultModel(this BrowserResponse response) | |
{ | |
return response.Context.NegotiationContext.DefaultModel; | |
} | |
} |
This file contains hidden or 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 TestRootPathProvider : IRootPathProvider | |
{ | |
private static string _cachedRootPath; | |
public string GetRootPath() | |
{ | |
//return @"C:\Applications\51\DeliveryDateCalculator\StandAndDeliver\Views\Home\"; | |
if (!string.IsNullOrEmpty(_cachedRootPath)) | |
return _cachedRootPath; |
This file contains hidden or 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 InMemoryDocumentStore : IDocumentStoreConnection | |
{ | |
public InMemoryDocumentStore() | |
{ | |
Store = new EmbeddableDocumentStore() | |
{ | |
RunInMemory = true | |
}; | |
Store.RegisterListener(new NoStaleQueries()); | |
Store.Initialize(); |
This file contains hidden or 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
ko.bindingHandlers.wysihtml5 = { | |
control: "", | |
init: function (element, valueAccessor, allBindingsAccessor, viewModel) { | |
control = $(element).wysihtml5({ | |
"events": { | |
"change" : function() { | |
var observable = valueAccessor(); | |
observable(control.getValue()); | |
} | |
} |