This file contains hidden or 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 IEnumerable<TResult> SelectManay<TSource, TCollection, TResult>(this IEnumerable<TSource> source, | |
Func<TSource, int, IEnumerable<TCollection>> collectionSelector, | |
Func<TSource, TCollection, TResult> resultSelector | |
) | |
{ | |
var index = 0; | |
foreach (TSource sourceItem in source) | |
{ | |
IEnumerable<TCollection> collection = collectionSelector(sourceItem, index); |
This file contains hidden or 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
internal class CompoundComparer<T> : IComparer<T> | |
{ | |
private readonly IComparer<T> primary; | |
private readonly IComparer<T> secondary; | |
internal CompoundComparer(IComparer<T> primary, | |
IComparer<T> secondary) | |
{ | |
this.primary = primary; | |
this.secondary = secondary; |
This file contains hidden or 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
// implement OrderBy and ThenBy | |
// reference1: http://msmvps.com/blogs/jon_skeet/archive/2011/01/04/reimplementing-linq-to-objects-part-26a-iorderedenumerable.aspx | |
// reference2: http://msmvps.com/blogs/jon_skeet/archive/2011/01/05/reimplementing-linq-to-objects-part-26b-orderby-descending-thenby-descending.aspx | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace OrderByAndThenBySample | |
{ |
This file contains hidden or 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
Feature: Score Calculation | |
As a player | |
I want the system to calculate my total score | |
So that I know my performance | |
Scenario: Homework scenario 1 | |
Given a new bowling game | |
When I roll the following series: 10,1,5,2,8,4,6,10,3,2,1,2,1,0,1,1,2,8,6 | |
Then my total score should be 98 |
This file contains hidden or 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; | |
using System.Collections.Generic; | |
namespace MessageHandler.Test | |
{ | |
public class MyService | |
{ | |
private ICustomerDao _customerDao; | |
public MyService(ICustomerDao customerDao) |
This file contains hidden or 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
Process 就像是「套路」。 | |
沒有內功,只有套路,那只是花拳繡腿。 | |
就像下面這一段:亢龍有悔。 | |
「洪七公左腿微屈,右臂內彎,右掌劃了個圓圈,呼的一聲,向外推去,手掌掃到面前一棵松樹,喀喇一響,松樹應手斷折。 」 | |
「郭靖拉開式子,挑了一棵特別細小的松樹,學著洪七公的姿勢,對準樹幹,呼的就是一掌。那松樹晃了幾晃,竟是不斷。洪七公罵道:『傻小子,你搖松樹幹什麼?捉松鼠麼?撿松果麼?』」 | |
在業界往往軟體工程導入,通常都是看到人家只是「左腿微屈,右臂內彎,右掌劃了個圓圈,呼的一聲,向外推去,手掌掃到面前一棵松樹,喀喇一響,松樹應手斷折」。然後就超級心動,覺得這招亢龍有悔真是好物!肯定可以讓我們輕鬆破敵! |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!--Default Root Path--> | |
<PropertyGroup> | |
<SolutionPath>$(MSBuildStartupDirectory)\MySolution.sln</SolutionPath> | |
<UnitTestSettingPath>$(MSBuildStartupDirectory)\MyTestSetting.testsettings</UnitTestSettingPath> | |
<AnalysisFileIncludes>$(MSBuildStartupDirectory)\**\*.cs</AnalysisFileIncludes> | |
<AnalysisFileExcludes>$(MSBuildStartupDirectory)\*Test*\**\*.*</AnalysisFileExcludes> | |
<ScenarioSourcePath>$(MSBuildStartupDirectory)\MyScenarioFolder</ScenarioSourcePath> | |
</PropertyGroup> |
This file contains hidden or 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
Feature: Login | |
In order to 避免非法使用者使用系統 | |
As a 系統管理者 | |
I want to be 檢查帳號密碼是否合法 | |
Scenario: 登入成功,導到首頁 | |
Given Login的頁面 | |
When 在帳號輸入"joey" | |
And 在密碼輸入"1234" | |
And 按下登入 |
This file contains hidden or 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 enum Command | |
{ | |
Next, | |
Reset | |
} | |
public enum State | |
{ | |
State1, | |
State2, |
This file contains hidden or 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; | |
using System.Collections.Generic; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System.Linq; | |
namespace CollectionAssertSample | |
{ | |
[TestClass] | |
public class UnitTest1 | |
{ |