1- using System . Collections . Generic ;
2- using System . Linq ;
1+ // This file was auto-generated based on version 1.0.1 of the canonical data.
2+
33using Xunit ;
44
55public class BookStoreTest
66{
77 [ Fact ]
8- public void Basket_with_single_book ( )
8+ public void Only_a_single_book ( )
99 {
10- Assert . Equal ( 8 , BookStore . CalculateTotalCost ( MakeList ( 1 ) ) ) ;
10+ var input = new [ ] { 1 } ;
11+ Assert . Equal ( 8 , BookStore . Total ( input ) ) ;
1112 }
1213
1314 [ Fact ( Skip = "Remove to run test" ) ]
14- public void Basket_with_two_of_same_book ( )
15+ public void Two_of_the_same_book ( )
1516 {
16- Assert . Equal ( 16 , BookStore . CalculateTotalCost ( MakeList ( 2 , 2 ) ) ) ;
17+ var input = new [ ] { 2 , 2 } ;
18+ Assert . Equal ( 16 , BookStore . Total ( input ) ) ;
1719 }
1820
1921 [ Fact ( Skip = "Remove to run test" ) ]
2022 public void Empty_basket ( )
2123 {
22- Assert . Equal ( 0 , BookStore . CalculateTotalCost ( MakeList ( ) ) ) ;
24+ var input = new int [ 0 ] ;
25+ Assert . Equal ( 0 , BookStore . Total ( input ) ) ;
2326 }
2427
2528 [ Fact ( Skip = "Remove to run test" ) ]
26- public void Basket_with_two_different_books ( )
29+ public void Two_different_books ( )
2730 {
28- Assert . Equal ( 15.2 , BookStore . CalculateTotalCost ( MakeList ( 1 , 2 ) ) ) ;
31+ var input = new [ ] { 1 , 2 } ;
32+ Assert . Equal ( 15.2 , BookStore . Total ( input ) ) ;
2933 }
3034
3135 [ Fact ( Skip = "Remove to run test" ) ]
32- public void Basket_with_three_different_books ( )
36+ public void Three_different_books ( )
3337 {
34- Assert . Equal ( 21.6 , BookStore . CalculateTotalCost ( MakeList ( 1 , 2 , 3 ) ) ) ;
38+ var input = new [ ] { 1 , 2 , 3 } ;
39+ Assert . Equal ( 21.6 , BookStore . Total ( input ) ) ;
3540 }
3641
3742 [ Fact ( Skip = "Remove to run test" ) ]
38- public void Basket_with_four_different_books ( )
43+ public void Four_different_books ( )
3944 {
40- Assert . Equal ( 25.6 , BookStore . CalculateTotalCost ( MakeList ( 1 , 2 , 3 , 4 ) ) ) ;
45+ var input = new [ ] { 1 , 2 , 3 , 4 } ;
46+ Assert . Equal ( 25.6 , BookStore . Total ( input ) ) ;
4147 }
4248
4349 [ Fact ( Skip = "Remove to run test" ) ]
44- public void Basket_with_five_different_books ( )
50+ public void Five_different_books ( )
4551 {
46- Assert . Equal ( 30 , BookStore . CalculateTotalCost ( MakeList ( 1 , 2 , 3 , 4 , 5 ) ) ) ;
52+ var input = new [ ] { 1 , 2 , 3 , 4 , 5 } ;
53+ Assert . Equal ( 30 , BookStore . Total ( input ) ) ;
4754 }
4855
4956 [ Fact ( Skip = "Remove to run test" ) ]
50- public void Basket_with_eight_books ( )
57+ public void Two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three ( )
5158 {
52- Assert . Equal ( 51.20 , BookStore . CalculateTotalCost ( MakeList ( 1 , 1 , 2 , 2 , 3 , 3 , 4 , 5 ) ) ) ;
59+ var input = new [ ] { 1 , 1 , 2 , 2 , 3 , 3 , 4 , 5 } ;
60+ Assert . Equal ( 51.2 , BookStore . Total ( input ) ) ;
5361 }
5462
5563 [ Fact ( Skip = "Remove to run test" ) ]
56- public void Basket_with_nine_books ( )
64+ public void Group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three ( )
5765 {
58- Assert . Equal ( 55.60 , BookStore . CalculateTotalCost ( MakeList ( 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 ) ) ) ;
66+ var input = new [ ] { 1 , 1 , 2 , 2 , 3 , 4 } ;
67+ Assert . Equal ( 40.8 , BookStore . Total ( input ) ) ;
5968 }
6069
6170 [ Fact ( Skip = "Remove to run test" ) ]
62- public void Basket_with_ten_books ( )
71+ public void Two_each_of_first_4_books_and_1_copy_each_of_rest ( )
6372 {
64- Assert . Equal ( 60 , BookStore . CalculateTotalCost ( MakeList ( 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 ) ) ) ;
73+ var input = new [ ] { 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 } ;
74+ Assert . Equal ( 55.6 , BookStore . Total ( input ) ) ;
6575 }
6676
6777 [ Fact ( Skip = "Remove to run test" ) ]
68- public void Basket_with_eleven_books ( )
78+ public void Two_copies_of_each_book ( )
6979 {
70- Assert . Equal ( 68 , BookStore . CalculateTotalCost ( MakeList ( 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 , 1 ) ) ) ;
80+ var input = new [ ] { 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 } ;
81+ Assert . Equal ( 60 , BookStore . Total ( input ) ) ;
7182 }
7283
7384 [ Fact ( Skip = "Remove to run test" ) ]
74- public void Basket_with_twelve_books ( )
85+ public void Three_copies_of_first_book_and_2_each_of_remaining ( )
7586 {
76- Assert . Equal ( 75.20 , BookStore . CalculateTotalCost ( MakeList ( 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 , 1 , 2 ) ) ) ;
87+ var input = new [ ] { 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 , 1 } ;
88+ Assert . Equal ( 68 , BookStore . Total ( input ) ) ;
7789 }
7890
79- private static List < int > MakeList ( params int [ ] values )
91+ [ Fact ( Skip = "Remove to run test" ) ]
92+ public void Three_each_of_first_2_books_and_2_each_of_remaining_books ( )
8093 {
81- return values . ToList ( ) ;
94+ var input = new [ ] { 1 , 1 , 2 , 2 , 3 , 3 , 4 , 4 , 5 , 5 , 1 , 2 } ;
95+ Assert . Equal ( 75.2 , BookStore . Total ( input ) ) ;
8296 }
83- }
97+ }
0 commit comments