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
| namespace Microsoft.Owin.Testing.Tests | |
| { | |
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Threading.Tasks; | |
| using Xunit; | |
| public class TestServerTests | |
| { |
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
| /* | |
| Usage: | |
| _storeEvents = Wireup | |
| .Init() | |
| .UsingFastInMemoryPersistence() | |
| .InitializeStorageEngine() | |
| .etc... | |
| */ | |
| // ReSharper disable CheckNamespace |
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 IWebApplication : IDisposable | |
| { | |
| public Func<IDictionary<string, object>, Task> AppFunc { get; } | |
| public string Url { get; } | |
| } | |
| // Start an app listen = false so that it is pure in-proc for testing. | |
| using(IWebApplication webApp = WebApplication.Start( | |
| builder => builder.UseThing(_foo), |
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 ContainsQueryTests : IDisposable | |
| { | |
| private readonly IDocumentStore _documentStore; | |
| public ContainsQueryTests() | |
| { | |
| _documentStore = new EmbeddableDocumentStore {RunInMemory = true}.Initialize(); | |
| using (IDocumentSession session = _documentStore.OpenSession()) | |
| { | |
| session.Store(new TestDocument |
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
| Before | |
| public class SimpleClass | |
| { | |
| [LogParamsOnException(LogLevel.Info)] | |
| void Method(string param1, int param2) | |
| { | |
| //Do Stuff | |
| } |
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
| var config = new LoggingConfiguration(); | |
| var nullTarget = new NullTarget(); | |
| config.AddTarget("NullTarget", nullTarget); | |
| config.LoggingRules.Add(new LoggingRule("Raven.*", LogLevel.Debug, nullTarget) { Final = true }); |
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
| using System; | |
| using System.Collections.Generic; | |
| using Microsoft.HttpListener.Owin; | |
| using Nancy.Hosting.Owin; | |
| namespace Spike | |
| { | |
| internal class Program | |
| { | |
| private static void Main(string[] args) |
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
| //Guard clauses / contracts omitted for berivity | |
| //Thread safety not considered. | |
| public interface IKeyValueStore | |
| { | |
| void Add<T>(string key, T item); | |
| void AddOrUpdate<T>(string key, T item); | |
| bool Remove(string key); |
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
| namespace WinPhoneKit.Storage | |
| { | |
| using System; | |
| using System.IO.IsolatedStorage; | |
| public static class IsolatedStorage | |
| { | |
| private static readonly IsolatedStorageSettings isolatedStorage = IsolatedStorageSettings.ApplicationSettings; | |
| public static void Add<TEntity>(string key, TEntity entity) |
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
| private static void Main(string[] args) | |
| { | |
| var server = new WebSocketServer("ws://127.0.0.1:8181"); | |
| server.Start(socket => | |
| { | |
| socket.OnOpen = () => Console.WriteLine("Open!"); | |
| socket.OnClose = () => Console.WriteLine("Close!"); | |
| socket.OnError = ex => Console.WriteLine("Server: " + ex); | |
| socket.OnMessage = message => | |
| { |