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
using System.Web.Mvc; | |
using FakeItEasy; | |
using Machine.Specifications; | |
using Machine.Specifications.Mvc; | |
using MSpecMvcApplication.Controllers; | |
namespace MSpecMvcApplication.Tests.Controllers | |
{ | |
[Subject(typeof(HomeController))] | |
public class when_the_home_controller_is_told_to_display_the_default_view |
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
SELECT | |
dataInt -- this is the "Content" node id | |
FROM [someTable].[dbo].[cmsPropertyData] PD | |
INNER JOIN cmsMember mb on PD.contentNodeId = mb.nodeId | |
WHERE LoginName = 'someLoginName' | |
AND dataInt IS NOT NULL | |
AND PD.propertyTypeId = the document type id of the "Content" node (see cmsPropertyType table) |
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
try | |
{ | |
//Code to perform some operation which could raise an exception | |
} | |
catch | |
{ | |
//Code to handle any exception that occurred in the try block | |
} |
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
try | |
{ | |
//Code to perform some operation | |
} | |
catch | |
{ | |
//Code to handle any exception that occurred in the try block | |
// No throw statement | |
} |
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
try | |
{ | |
//Code to perform some operation | |
} | |
catch | |
{ | |
//Code to handle any exception that occurred in the try block | |
throw; // the throw keyword will pass or throw the exception to the calling 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
public void SomeMethod(SomeObject obj) | |
{ | |
obj.DoSomething(); | |
} |
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 void SomeMethod(ISomeInterface interface) | |
{ | |
interface.DoSomething(); | |
} |
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 person = new Person(); | |
string dateOfBirth = "10 May 1989"; | |
Console.WriteLine(person.GetAge(dateOfBirth)); | |
} | |
} |
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
[Fact] | |
public void GetAfterPostReturnsCorrectStatusCodeWithPostedEntry() | |
{ | |
using (var client = MyHttpClientFactory.Create()) | |
{ | |
var json = new | |
{ | |
time = DateTimeOffset.Now | |
, | |
distance = 8500 |
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)); | |
} |