Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Set the status

DavidSSL

💭
Set the status
View GitHub Profile
View No use of delegate
class Program
{
static void Main()
{
Person.Eats();
}
}
public class Person
{
View Simple delegate example excerpt
class Program
{
// 1 Declaration of a delegate type
public delegate void PersonEatsDelegate();
static void Main()
{
// 3 Instantiation of a delegate (short form)
PersonEatsDelegate personEatsDelegate = Person.Eats;
View PersonEatsDelegateDecompiledIL
.class private auto ansi sealed StartApp.PersonEatsDelegate
extends [mscorlib]System.MulticastDelegate
{
// Methods
.method public hidebysig specialname rtspecialname
instance void .ctor (
object 'object',
native int 'method'
) runtime managed
{
View gist:8dacd1c1d0ed4e1ca56a
Interface IMyInterface
{
void SomeMethod();
}
View PersonUsedToDelegate
class Person
{
public static void Eats()
{
// Some implementation
}
public static void Says(string message)
{
// Some implementation
View NLog loggin example
public ActionResult Send()
{
_logger.Info("In Send method");
...
}
View NLog best practice
private ILogger _logger = NullLogger.Instance;
public ILogger Logger
{
get { return _logger; }
set { _logger = value; }
}
View NLogConfigurationExample
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
See http://nlog-project.org/wiki/Configuration_file
for information on customizing logging rules and outputs.
-->
<targets>
<!-- add your targets here -->
@DavidSSL
DavidSSL / Semantic comparison test
Last active Dec 16, 2015
Correct implementation of Parser Test
View Semantic comparison test
[Theory, AutoFixture]
public void ParseValidInputShouldReturnCorrectResult(
PatientReportParser sut)
{
const string argsString = @"-o=C:\Temp\someFile -p=1 -d";
var args = new string[0];
IResult actualResult = null;
var expectedResult =
new Likeness<CreateReportResult, CreateReportResult>(new CreateReportResult(@"C:\Temp\someFile", "1", "database"));
@DavidSSL
DavidSSL / IResultTest
Created Apr 18, 2013
Problem IResult
View IResultTest
[Theory, AutoFixture]
public void ParseValidInputShouldReturnCorrectResult(
PatientReportParser sut)
{
const string argsString = @"-o=C:\Temp\someFile -p=1 -d";
var args = new string[0];
IResult actualResult = null;
"Given valid arguments"
.Given(() => args = argsString.Split(' '));