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
[TestFixture] | |
public class Test : Calculator | |
{ | |
[Test] | |
public void No_books_are_0() | |
{ | |
Assert.AreEqual(0, Price()); | |
} | |
[Test] |
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 static class Extensions | |
{ | |
public static bool And(this IEnumerable<bool> bools) | |
{ | |
return bools.Foldr(Expression.AndAlso, true); | |
} | |
public static T Foldr<T>(this IEnumerable<T> enumerable, Func<Expression, Expression, BinaryExpression> fold, T v) | |
{ | |
foreach(var b in enumerable) |
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
<UsingTask | |
TaskName="Costura.EmbedTask" | |
AssemblyFile="$(SolutionDir)[path to]\Costura.dll" /> | |
<Target Name="AfterBuild"> | |
<Costura.EmbedTask /> | |
</Target> |
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
IEnumerable<string> Anagrams(IEnumerable<char> input) | |
{ | |
foreach (var c in input) | |
{ | |
var except = input.Except(new[]{c}); | |
if(except.Any()) | |
foreach (var element in Anagrams(except)) | |
yield return c.ToString() + element; | |
else |
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(var c = new WebClient()) | |
{ | |
c.DownloadStringCompleted += (_, r) => Console.WriteLine(r.Result); | |
c.DownloadStringAsync(new Uri("http://www.google.at")); | |
} |
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
class Options : DynamicObject | |
{ | |
readonly IDictionary<string, object> inner = new ExpandoObject(); | |
public override bool TryGetMember(GetMemberBinder binder, out object result) | |
{ | |
if (!inner.TryGetValue(binder.Name, out result)) | |
result = false; | |
else | |
result = result != null ? new OptionValue(result.ToString()) : (dynamic)true; |
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
void Main() | |
{ | |
new NUnitLite.Runner.TextUI().Execute(new[]{"-noheader"}); | |
} | |
// Define other methods and classes here | |
[Test] | |
public void SomeTest() | |
{ | |
Assert.Pass(); |
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
[Test] | |
public void OneSimpleTest() | |
{ | |
var eightBall = new EightBall(); | |
var answer = eightBall.ShouldIChangeJob(); | |
Assert.That(answer, Is.True); | |
} |
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
[Test] | |
public async void OneSimpleTest() | |
{ | |
var eightBall = new EightBall(); | |
var answer = await eightBall.ShouldIChangeJob(); | |
Assert.That(answer, Is.True); | |
// why am I still here? | |
} |
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
[Test] | |
public void OneSimpleTest() | |
{ | |
var eightBall = new EightBall(); | |
Task<bool> answer = eightBall.ShouldIChangeJob(); | |
answer.Wait(); | |
Assert.That(answer.Result, Is.True); | |
} |
OlderNewer