public void Test2() { var contextMock = new Mock <IReadContext>(); contextMock.Setup(x => x.Employees).Returns(new[] { new ExcelEmployee { SapId = "S01" } }); contextMock.Setup(x => x.BusinessTrips).Returns(new[] { new ExcelBusinessTrip { EmployeeSapId = "S01", DaysInBusinessTrip = 13 }, new ExcelBusinessTrip { EmployeeSapId = "S02", DaysInBusinessTrip = 10 } }); var sut = new EmployeeExcelReader(contextMock.Object); var result = sut.GetEmployees(); Assert.Equal(new[] { new BusinessTrip(13) }, result.Single().BusinessTrips); }
public void Test3() { var contextMock = new Mock <IReadContext>(); contextMock.Setup(x => x.Employees).Returns(new[] { new ExcelEmployee { SapId = "S01" } }); contextMock.Setup(x => x.TimeSheetEntries).Returns(new[] { new ExcelTimeSheetEntry { EmployeeSapId = "S01", Operation = "A" }, new ExcelTimeSheetEntry { EmployeeSapId = "S01", Operation = "B" } }); var sut = new EmployeeExcelReader(contextMock.Object); var result = sut.GetEmployees(); Assert.Equal(new[] { new TimeSheetEntry("A", DateTime.Now), new TimeSheetEntry("B", DateTime.Now) }, result.Single().TimeSheetEntries, new TimesheetComparer()); }
public void Test5() { var contextMock = new Mock <IReadContext>(); contextMock.Setup(x => x.Employees).Returns(new[] { new ExcelEmployee { SapId = "S01" } }); contextMock.Setup(x => x.TimeSheetEntries).Returns(new[] { new ExcelTimeSheetEntry { EmployeeSapId = "S02", Operation = "A" }, new ExcelTimeSheetEntry { EmployeeSapId = "S02", Operation = "B" } }); var sut = new EmployeeExcelReader(contextMock.Object); var result = sut.GetEmployees(); Assert.Empty(result.Single().TimeSheetEntries); }