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
Testing |
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 NugetPackageInstallationTests : IDisposable | |
{ | |
private readonly string _originalWorkingDirectory; | |
private readonly string _filesDirectory; | |
private string _localDirectory; | |
public NugetPackageInstallationTests() | |
{ | |
_originalWorkingDirectory = Environment.CurrentDirectory; | |
_filesDirectory = Path.Combine(AcceptanceTestHelpers.GetExecutingAssemblyDirectory(), "Files"); |
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
[Trait("AcceptanceTest", "RunningScriptsTests")] | |
[Trait("Requires", "Internet Connection")] | |
[Trait("Requires", "Administrator Privileges")] | |
public void RunningWebApiHostSampleEnablesWebAccessInLocalhostXBehave(string originalWorkingDirectory, Task<int> scriptTask) | |
{ | |
const string MethodName = "RunningWebApiHostSampleEnablesWebAccessInLocalhostXBehave"; | |
"Given an existing Web API host sample (similar to https://github.com/scriptcs/scriptcs-samples/tree/master/webapihost)" | |
._(() => | |
{ |
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 Roslyn.Scripting.CSharp; | |
using System; | |
namespace RoslynTests | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var script = "using System; public class Test{ public void Do<T>() where T : IDisposable{ } }"; |
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
class ProgramWithAPM : IRunnable | |
{ | |
private int pending; | |
private readonly object lockObject; | |
public ProgramWithAPM() | |
{ | |
this.pending = 0; | |
this.lockObject = new object(); |
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
const uint Flags = 128 | (uint)1 << 30; | |
var fileHandle = Interop.CreateFile("test.txt", (uint)1 << 31, 0, IntPtr.Zero, 3, | |
/*FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED */ Flags, | |
IntPtr.Zero); | |
Interop.CreateIoCompletionPort( | |
fileHandle, | |
completionPortHandle, | |
(uint)fileHandle.ToInt64(), |
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
static void Main() | |
{ | |
var fs = new FileStream("test.txt", FileMode.Open, FileAccess.Read, FileShare.None, 1024, true); | |
var buffer = new byte[1024]; | |
fs.BeginRead(buffer, 0, 1024, ReadCallback, new State { Buffer = buffer, FileStream = fs }); | |
Console.ReadLine(); | |
} |
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 Owin.IpFilter | |
{ | |
using System; | |
using System.Net; | |
public static class Extensions | |
{ | |
public static IAppBuilder UseIpFiltering(this IAppBuilder appBuilder, Func<IPAddress, bool> rejectRequest) | |
{ | |
appBuilder.Use(typeof(IpFilterMiddleware), rejectRequest); |
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 net = Require<Net>(); | |
var server = net.CreateServer(socket => | |
{ | |
Console.WriteLine("New connection"); | |
socket.On( | |
data: bytes => Console.Write(bytes.AsString()), | |
close: () => Console.WriteLine("Connection closed"), | |
error: e => Console.WriteLine("Error: {0}\r\nStackTrace: {1}", e.Message, e.StackTrace)); |
OlderNewer