Skip to content

Instantly share code, notes, and snippets.

View EricRohlfs's full-sized avatar

Eric Rohlfs EricRohlfs

View GitHub Profile
@EricRohlfs
EricRohlfs / gist:64bb6374e52fbdcc3047
Created May 7, 2015 20:42
Unit Testing Invalid Model State in WebApi2
[TestMethod]
public void WhenModelStateIsInvalidDoNotSave()
{
var mockRepo = new Mock<IProductRepo>();
mockRepo.Setup(x=>x.Save(It.IsAny<Product>());
var ctrl = new ProductController(mockRepo.Object);
ctrl.ModelState.AddModelError("SomeRandomProperty","SomeRandomProperty was not valid");
var actual = ctrl.Post(new Product());
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
'use strict';
(function() {
var mod = angular.module("App.services", []);
//register other services here...
/* pubsub - based on https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js*/
mod.factory('pubsub', function() {
var cache = {};
@EricRohlfs
EricRohlfs / LastInWinsReplicationConflictResolver.cs
Created August 16, 2012 02:00 — forked from jtbennett/LastInWinsReplicationConflictResolver.cs
RavenDB LastInWinsReplicationConflictResolver
using System;
using System.Linq;
using NLog;
using Raven.Abstractions.Data;
using Raven.Bundles.Replication;
using Raven.Bundles.Replication.Plugins;
using Raven.Json.Linq;
namespace MyRavenReplicationBundle
{