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 Task<dynamic> ReadAsJsonAsync(this HttpContent content) | |
{ | |
if (content == null) | |
throw new ArgumentNullException("content"); | |
return content.ReadAsStringAsync().ContinueWith(t => | |
JsonConvert.DeserializeObject(t.Result)); | |
} |
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
class Program | |
{ | |
static void Main() | |
{ | |
Person.Eats(); | |
} | |
} | |
public class Person | |
{ |
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
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; |
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
private ILogger _logger = NullLogger.Instance; | |
public ILogger Logger | |
{ | |
get { return _logger; } | |
set { _logger = value; } | |
} |
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 ActionResult Send() | |
{ | |
_logger.Info("In Send method"); | |
... | |
} |
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
<?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 --> |
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
[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")); |
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
[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(' ')); |
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 interface IResult | |
{ | |
void Execute(); | |
} | |
public class ErrorResult : IResult | |
{ | |
public void Execute() | |
{ | |
// Does something |
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 void Main() | |
{ | |
// 1. Instantiate the IWindsor container object | |
var container = new WindsorContainer(); | |
// 2. Register the services and the respective components that implement them | |
container.Register(Types | |
.FromAssemblyContaining<HttpFileDownloader> | |
.BasedOn<IHtmlTitleRetriever>()); | |
); | |
// 3. "Resolve" the root service |
NewerOlder