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 Microsoft.VisualStudio.TestTools.UnitTesting; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
namespace CsvReportGeneratorTests | |
{ | |
public class CsvReportAttribute : Attribute |
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
[TestMethod] | |
public void TestCollection() | |
{ | |
var expected = new | |
{ | |
//Orders = (new List<int> { 11, 12 }).Select(p => new { Id = p }) | |
Orders = new[] | |
{ | |
new { Id = 11 }, | |
new { Id = 12 } |
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 Microsoft.VisualStudio.TestTools.UnitTesting; | |
using NSubstitute; | |
namespace MvpRenewTest | |
{ | |
[TestClass] | |
public class MvpTests | |
{ | |
//[TestMethod] | |
//public void TestMethod_MVP現有類別不在指定類別內並且不是十月份MVP可以自動延長一年() |
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 class UnitTest1 | |
{ | |
[Fact] | |
public void TestMethod1() | |
{ | |
var target = new Joey(); | |
var ex = Assert.Throws(typeof(ArgumentException), () => { target.ThrowEx(2); }); | |
Assert.True(ex.Message.Contains("不能是偶數")); |
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
順便補充一下,昨天問到我那個 「Google Search 的 feature,幾乎就把整個 product 涵蓋完」了的問題。 | |
今天早上走到公司的時候,有一些比較清晰的想法。 | |
其實重點還是回歸到 user story。我們現在看到最後的 user story 都是精鍊過的,所以可能比較沒有感覺。 | |
一樣是 search engine,我舉幾個例子來描述不同的 user story。 | |
user story 1: | |
我是一個阿宅,平時很少出門逛街買東西,更不知道女生喜歡什麼樣的東西。有一次,我喜歡的女生在 Facebook 上貼了一篇文章,提到網頁上那個女生的包包一整個是她的菜。 | |
我喜歡她,她的生日快到了,我想要在她生日的時候,送她這個包包。但我壓根不知道包包該去哪買,包包的相關資訊。 | |
所以我希望,我可以在搜尋首頁上,貼上那個包包的圖片,就可以找到這個包包的相關資訊。讓我可以有機會,追到這個女生。 | |
Feature: 以圖找圖 |
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 System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
//using Rhino.Mocks; | |
using RsaSecureToken; | |
using NSubstitute; |
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 interface IFoo | |
{ | |
string Bar(int a, string b); | |
} | |
[TestMethod] | |
public void Test_ReturnFromFunction_CallInfo() | |
{ | |
var foo = Substitute.For<IFoo>(); | |
foo.Bar(0, "").ReturnsForAnyArgs(x => "Hello " + x.Arg<string>()); |
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
[TestMethod] | |
public void TestMethod1() | |
{ | |
//arrange | |
var p = new Person(); | |
MockContext.MockNow = new DateTime(2011, 1, 1); | |
var result = p.Cal(); |
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
this.Then(/^item info - "([^"]+)" should match/, function(key, next) { | |
itemPage.getInfo(key).then( | |
function(data) { | |
//data: {info, pattern} | |
expect(data.pattern.test(data.info), 'itemInfo match error').to.be.true; | |
} | |
).then(next, next); | |
}); |
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: 登入 | |
Scenario: 登入成功 | |
Given 我連到登入頁面 | |
And 我在帳號輸入 "joey" | |
And 我在密碼輸入 "1234" | |
When 我按下登入按鈕 | |
Then 應該被導到首頁 | |
Scenario: 登入失敗 |