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
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
--aligator => crocodile | |
ALTer procedure OrderJobs | |
( | |
@jobs varchar(max) |
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 static BeforeFilters operator +(BeforeFilters filters, Func<RequestContext, Response> filter) | |
{ | |
filters.AddFilterToEnd(filter); | |
return filters; | |
} | |
public void AddFilterToEnd(Func<RequestContext, Response> filter) | |
{ | |
Filters.Add(filter); | |
} |
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
Most programming environments have two kinds of data. Record types allow you to structure data into meaningful groups. Primitive types are your building blocks. Records always carry a certain amount of overhead. They may mean tables in a database, or they may be awkward to create when you want them for only one or two things. | |
One of the valuable things about objects is that they blur or even break the line between primitive and larger classes. You can easily write little classes that are indistinguishable from the built-in types of the language. Java does have primitives for numbers, but strings and dates, which are primitives in many other environments, are classes. | |
People new to objects usually are reluctant to use small objects for small tasks, such as money classes that combine number and currency, ranges with an upper and a lower, and special strings such as telephone numbers and ZIP codes. You can move out of the cave into the centrally heated world of objects by using Replace Data Value with Object o |
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
--- this one may impact performance run at a quiet time | |
-- change INSERT YOUR DB NAME HERE to your db name | |
SELECT object_name(IPS.object_id) AS [TableName], | |
SI.name AS [IndexName], | |
IPS.Index_type_desc, | |
IPS.avg_fragmentation_in_percent, | |
IPS.avg_fragment_size_in_pages, | |
IPS.avg_page_space_used_in_percent, | |
IPS.record_count, |
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 TestingAnAbstractClassWithAFake | |
{ | |
private class FakeConcreteInstance : MyAbstractClass | |
{} | |
[Fact] | |
public void Should_return_correct_message() | |
{ |
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 TestingAnAbstractClassWithAMock | |
{ | |
[Fact] | |
public void Should_return_correct_message() | |
{ | |
var mock = new Mock<MyAbstractClass>(); | |
var result = mock.Object.MyMethodOnAbstractClass("fish"); | |
Assert.Equal("I like fish in an abstract sense.", result); | |
} | |
} |
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 abstract class AbstractTestBaseClass | |
{ | |
protected MyAbstractClass AbstractedVariable; | |
[Fact] | |
public void Should_return_correct_message() | |
{ | |
var result= AbstractedVariable.MyMethodOnAbstractClass("input"); | |
Assert.Equal("I like input in an abstract sense.", result); | |
} | |
} |
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 MyAbstractClass | |
{ | |
public string MyMethodOnAbstractClass(string input) | |
{ | |
return "I like " + input + " in an abstract sense."; | |
} | |
} |
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
[Subject("SELECT Executing")] | |
public class When_executing_select_from_users | |
{ | |
Establish that = () => { | |
q.ConnectionString = connectionString; | |
}; | |
Because of = () => result = (q.SELECT * q.FROM.Users).GO(); //Users is dynamic | |
It should_return_select_star_from_users = () => result.Count.ShouldEqual(0); | |
static IList<DataRecord> result; | |
static string connectionString = @"Data Source = |DataDirectory|\TestDb.sdf"; |
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
[Subject("Inspecting SQL")] | |
public class When_calling_select_from_users_with_predicate_collection | |
{ | |
Because of = () => result = (q.SELECT * q.FROM.Users.WHERE.UserId.IN(1,2)).ToString(); | |
It should_return_select_star_from_users = () => result.ShouldEqual("SELECT * FROM Users WHERE UserId IN (1,2)"); | |
static string result; | |
} |