Skip to content

Instantly share code, notes, and snippets.

@marcusoftnet
marcusoftnet / gist:1222823
Created September 16, 2011 18:58
Base for a repository demo test with Simple.Data.FakeResult
using System;
using System.Collections.Generic;
using FakeItEasy;
using NUnit.Framework;
using Simple.Data.FakeResult;
namespace TestingWithSimpleDataFakeResult
{
[TestFixture]
public class RepositoryUsingSimpleDataTests
@marcusoftnet
marcusoftnet / gist:1222941
Created September 16, 2011 19:41 — forked from Vidarls/gist:1222865
Base for a repository demo test with Simple.Data.FakeResult
using System;
using System.Collections.Generic;
using FakeItEasy;
using NUnit.Framework;
using Simple.Data.FakeResult;
namespace TestingWithSimpleDataFakeResult
{
[TestFixture]
public class RepositoryUsingSimpleDataTests
@marcusoftnet
marcusoftnet / gist:1228878
Created September 20, 2011 11:15
Formatting suggestion Simple.Data.FakeResult
[Fact]
public void Can_assert_on_a_part_of_a_longer_method_chain()
{
dynamic fakeResult = FakeResult.For
.Table
.FindAll()
.OrderById()
.Returns();
fakeResult.Table
@marcusoftnet
marcusoftnet / gist:1228882
Created September 20, 2011 11:21
Suggestions for FakeResult.Table
[Fact]
public void using_the_table_property_only()
{
dynamic fakeResult = FakeResult.For.Table
.Returns(new List<User> {Name = "User 1", Name = "User 2", Name= "User 3"});
fakeResult.Table
.FindAllByName()
.OrderByName
.JoinOnOrdersById()
@marcusoftnet
marcusoftnet / gist:1379343
Created November 19, 2011 20:52
Joins in Simple.Data fails with "The multi-part identifier "dbo.Categories.Name" could not be bound."
// I run this join and get a
// Simple.Data.Ado.AdoAdapterException : The multi-part identifier "dbo.Categories.Name" could not be bound.
// -- from a System.Data.SqlClient.SqlException : The multi-part identifier "dbo.Categories.Name" could not be bound.
result = db.Items.FindAll(db.Items.UserId == userId &&
db.Items.Categories.Name == category)
.Cast<ListItemsViewModel>();
// On these tables
CREATE TABLE [dbo].[Users](
@marcusoftnet
marcusoftnet / gist:1383791
Created November 21, 2011 20:16
Razor view throwing error
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>whimree - Create new Item</title>
</head>
<body>
<h1>whimree - All items for @Model[0].UserName</h1>
<table>
<thead>
@marcusoftnet
marcusoftnet / dabblet.css
Created December 19, 2011 08:05
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f00;
background: linear-gradient(45deg, #f14, yellow);
min-height:100%;
@marcusoftnet
marcusoftnet / gist:1551941
Created January 2, 2012 20:15
JSON from NewtonSoft
[
{
"IsContent": false,
"Name": "Feature Crawler Tests",
"OriginalLocation": {
"OriginalPath": "FakeFolderStructures\\FeatureCrawlerTests",
"FullPath": "C:\\Dev\\pickles\\src\\Pickles\\Pickles.Test\\bin\\Release\\FakeFolderStructures\\FeatureCrawlerTests"
},
"OriginalLocationUrl": "file:///C:/Dev/pickles/src/Pickles/Pickles.Test/bin/Release/FakeFolderStructures/FeatureCrawlerTests",
@marcusoftnet
marcusoftnet / gist:1556391
Created January 3, 2012 19:10
I don't understand InMemoryAdapter.ConfigureJoin or Join doesn't work for InMemoryAdapter
using System;
using System.Linq;
using Simple.Data;
using Xunit;
using System.Collections.Generic;
namespace AbbeSays.Tests
{
public class DemoTestsForJoins
{
@marcusoftnet
marcusoftnet / gist:1564347
Created January 5, 2012 09:03
Triangle kata with Haacked naming convention
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace TriangleKata
{
public class SideFacts
{
public class length_is_valid_when_greater_than_0