public void Test2Orders() { // arrange List <string> data = new List <string>(); data.Add("[email protected] 2021-02-11 10:00 P01 1"); data.Add("[email protected] 11-02-2021 15:00"); data.Add("P02b 2"); int ordersQnty = 1; IData fileData = new DataStub(data); // act var orders = ReportsGenerator.ReadOrders(fileData); int items = orders.Sum(o => o.Items.Count); // assert ordersQnty.Should().Be(items); }
public void TestDiscount() { // arrange List <string> data = new List <string>(); data.Add("[email protected] 2021-02-11 10:00 !SALE1102 P01 1"); data.Add("[email protected] 2021-02-11 15:00 P02b 2"); data.Add("[email protected] 2021-02-11 12:30 !SALE1102"); data.Add("P01"); data.Add("P42 5"); IData fileData = new DataStub(data); ITime time = new TimeStub(new DateTime(2021, 02, 11)); // act ReportsGenerator.TodaysOrdersReport(fileData, time); bool isError = ReportsGenerator.isError; // assert isError.Should().BeFalse(); }
public void TestErrorLineNumber() { // arrange List <string> data = new List <string>(); data.Add("[email protected] 2021-02-11 10:00 P01 1"); data.Add("[email protected] 2021-02-11 15:00 P02b 2"); data.Add("[email protected] 21-02-2011 12:30"); data.Add("P01"); data.Add("P42 5"); IData fileData = new DataStub(data); ITime time = new TimeStub(new DateTime(2021, 02, 11)); int errorLine = 3; // act ReportsGenerator.TodaysOrdersReport(fileData, time); int line = ReportsGenerator.lineNumber; // assert errorLine.Should().Be(line); }