static void Main(string[] args) { Console.WriteLine("請輸入查詢分組單位以幾筆為一組:"); var groupCount = Console.ReadLine(); Console.WriteLine("請輸入查詢分組總和的欄位:"); var groupColumn = Console.ReadLine(); GroupSumService gsService = new GroupSumService(GetObjectType()); var result = gsService.GetSummary(Int32.Parse(groupCount), groupColumn); }
public void 測試Expection_2筆一組_取SellPrice總和_輸入不存在的欄位_使用FluentAssertions() { //arrange var target = new GroupSumService(new HomeworkDao()); var groupCount = 9; var groupColumn = "badasfda"; var expected = new List <int>() { 225, 61 }; Action act = () => target.GetSummary(groupCount, groupColumn); act.ShouldThrow <NullReferenceException>(); }
public void 測試Expection_2筆一組_取SellPrice總和_輸入不存在的欄位() { //arrange var target = new GroupSumService(new HomeworkDao()); var groupCount = 9; var groupColumn = "dasfasdf"; var expected = new List <int>() { 225, 61 }; //act var actual = target.GetSummary(groupCount, groupColumn); //assert CollectionAssert.AreEqual(expected, actual); }
public void 測試_2筆一組_取SellPrice總和_使用自訂類別() { //arrange var target = new GroupSumService(new ExtraDao()); var groupCount = 9; var groupColumn = "col3"; var expected = new List <int>() { 225, 61 }; //act var actual = target.GetSummary(groupCount, groupColumn); //assert CollectionAssert.AreEqual(expected, actual); }
public void 測試_4筆一組_取Revenue總和() { //arrange var target = new GroupSumService(new HomeworkDao()); var groupCount = 4; var groupColumn = "revenue"; var expected = new List <int>() { 50, 66, 60 }; //act var actual = target.GetSummary(groupCount, groupColumn); //assert CollectionAssert.AreEqual(expected, actual); }
public void 測試_3筆一組_取Cost總和() { //arrange var target = new GroupSumService(new HomeworkDao()); var groupCount = 3; var groupColumn = "cost"; var expected = new List <int>() { 6, 15, 24, 21 }; //act var actual = target.GetSummary(groupCount, groupColumn); //assert CollectionAssert.AreEqual(expected, actual); }