Skip to content

Instantly share code, notes, and snippets.

View PaulCampbell's full-sized avatar

@paulcampbell_ PaulCampbell

  • UK
View GitHub Profile
@PaulCampbell
PaulCampbell / RestSharpXmlSerializer
Created July 5, 2012 09:03
Overriding the rest# serialiser
public class RestSharpXmlSerializer : RestSharp.Serializers.ISerializer
{
public string Serialize(object obj)
{
string retval = null;
if (obj != null)
{
var sb = new StringBuilder();
using (var writer = XmlWriter.Create(sb, new XmlWriterSettings() { OmitXmlDeclaration = true }))
[Test]
public void proclaimer_falls_down_at_door()
{
var proclaimer = nSubstitue.For<IProclaimer>();
proclaimer.Walk500Miles().Returns("One thousand miles walked");
var door = nSubstitue.For<IDoor>();
var sut = new ProclaimerGoesAboutHisBusinessService(proclaimer, door);
@PaulCampbell
PaulCampbell / IJsonService<T>
Created March 25, 2011 12:53
Generic repository style service for REST services
public interface IJsonService<T>
{
// Methods
void Delete(T entity);
IList<T> FindAll(IDictionary<string, object> propertyValuePairs, int pageNo, int resultsPerPage, string sortBy, string sortDirection);
T Get(int id);
IList<T> Get(List<int> IDs);
IList<T> GetAll(int pageNo, int resultsPerPage, string sortBy, string sortDirection, string segment);
RestResult Save(T entity);
RestResult Update(T entity);
require 'rake'
require 'configatron'
require 'pp'
task :setEnvironmentVariables do
$env = ENV['environment']
if $env.nil?
puts "Please enter an environment to deploy this build to."
@PaulCampbell
PaulCampbell / dotnet configuration with Rake
Created October 25, 2010 13:50
Basic rake script for configuring .net projects with yaml and configatron
require 'rake'
require 'configatron'
require 'pp'
task :setEnvironmentVariables do
$env = ENV['environment']
if $env.nil?
puts "Please enter an environment to deploy this build to."
fail