👷♂️
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 class ListOfAValidAndAInvalidRequirement { | |
OnEstablish context = | |
fakeAccessor => | |
{ | |
IRequirement validRequirement = fakeAccessor.An<IRequirement>(); | |
validRequirement.WhenToldTo(r => r.Validate()).Return(true); // throws ex here | |
IRequirement invalidRequirement = fakeAccessor.An<IRequirement>(); | |
invalidRequirement.WhenToldTo(r=>r.Validate()).Return(false); | |
IList<IRequirement> requirements = new List<IRequirement> | |
{ |
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
I have to implement a method that does some string formatting based on string property values of two COM objects. | |
Now there are at least two ways to deal with it... | |
a) passing in the objects: | |
public string CreateIdForPartInView(IPartDoc part, IView drawingView) { | |
IModelDoc2 model = part as IModelDoc2; | |
string modelPath = model.GetPathName(); | |
string modelName = Path.GetFileNameWithoutExtension(modelPath); | |
string id = string.Format("{0}-1@{1}", modelName, drawingView.Name); |
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 class Given_two_lists_containing_a_point_each_when_comparing_points_on_x_value { | |
static IList<Point> _expectedPoints; | |
static IList<Point> _actualPoints; | |
Establish context | |
= () => { | |
_expectedPoints = new List<Point> | |
{ | |
new Point {X = 153.6m, Y = 21m, Z = 0} | |
}; |
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 override object CreateFake(Type firstInterfaceType, Type secondInterfaceType) | |
{ | |
var closedFirstMockType = typeof(Mock<>).MakeGenericType(firstInterfaceType); | |
var closedSecondMockType = typeof (Mock<>).MakeGenericType(secondInterfaceType); | |
var objectProperty = closedFirstMockType.GetProperty("Object", closedFirstMockType); | |
var instance = Activator.CreateInstance(closedFirstMockType); | |
return objectProperty.GetValue(instance, null); | |
} | |
Tried: |
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 class StepFileItemState { | |
private Action _processToNextStep; | |
public static readonly StepFileItemState Uploaded = | |
new StepFileItemState() { | |
_proceedToNextStep = () => { | |
// impl | |
} | |
}; |
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 Machine.Fakes; | |
using Machine.Specifications; | |
namespace BehaviorConfigInheritance { | |
public class Given_a_car_when_starting_it : WithSubject<Car> { | |
static string _sound; | |
Establish context = () => | |
{ | |
//With(new EngineLoaded(300)); |
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
[ | |
{ | |
"Button": { | |
"de-DE": "Speichern", | |
"en-GB": "Save" | |
} | |
}, | |
{ | |
"Email": { | |
"de-DE": "E-Mail-Adresse", |
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
Start a project from scratch | |
Install-Package WebApi.All | |
Install-Package WebApiContrib | |
var config = new WebApiConfiguration(); | |
config.Formatters.Clear(); | |
config.Formatters.Add(new JsonNetFormatter()); // doesn't compile here | |
cannot convert from 'WebApiContrib.Formatters.JsonNet.JsonNetFormatter' to 'System.Net.Http.Formatting.MediaTypeFormatter' |
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
div[class*='tocolor-'] {color:red } |
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
<nav id="menu"> | |
<ul id="thelist" data-bind="foreach: contents"> | |
<li><span data-bind="text: title"></span></li> | |
</ul> | |
</nav> |