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
[Fact] | |
public void selectManyTest() | |
{ | |
var s = "2#3,4%5"; | |
var delimiters = "#,%"; | |
var e = delimiters | |
.Aggregate(Enumerable.Repeat(s, 1), (current, delimiter) => | |
current.SelectMany(s1 => s1.Split(delimiter))); | |
e.Should().Equal(new[] {"2", "3", "4", "5"}); |
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 System.Collections.Generic; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using FluentAssertions; | |
using NUnit.Framework; | |
using Nancy.Helpers; | |
namespace NancySelfHosting |
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
[Fact] | |
public void should_throw_exception_for_negatives() | |
{ | |
// act | |
Action c = () => calculator.Add("-1,2"); | |
// assert | |
c.ShouldThrow<Exception>().WithMessage("negatives are not allowed"); | |
} |
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 void Sort(List<Person> data) | |
{ | |
Person tmp = null; | |
for(int i = 0; i<data.Count; i++) | |
{ | |
for(int j = i; j<data.Count; j++) | |
{ | |
if(data[j].Compare(data[i])) | |
{ | |
tmp = data[j]; |
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
data = PersonHelper.SortPersonsByAge(data, Constants.MinAge, Constants.MaxAge); | |
// .... | |
/// <summary> | |
/// Sorts list of persons | |
/// </summary> | |
public static List<Person> SortPersonsByAge(IList<Person> persons, int minAge, int maxAge) | |
{ |
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
// declaration | |
public class ServiceLogger : IServiceLogger | |
{ | |
private readonly ILog log; | |
public ServiceLogger(object o) | |
{ | |
log = LogManager.GetLogger(o.GetType().Name); | |
} |
NewerOlder