public void GivenMultipleEmployeeDataToAddWithThreadingAndInSynchronisation_ToList_ShouldGiveElapsedTime() { List <EmployeeModel> employeeList = AddingDataToList(); MultiThreadingOperations multiThreading = new MultiThreadingOperations(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); multiThreading.AddEmployeesWithThreadsAndSynchronization(employeeList); stopwatch.Stop(); Console.WriteLine("Time taken while adding to list with threading:{0} ", stopwatch.Elapsed); }
public void GivenMultipleEmployeeDataToAddWithThreading_WhenDatabaseIsConnected_ShouldGiveElapsedTime() { // Act List <EmployeeModel> employeeList = AddingDataToList(); MultiThreadingOperations multiThreading = new MultiThreadingOperations(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); multiThreading.AddEmployeeListToDBWithThread(employeeList); stopwatch.Stop(); Console.WriteLine("Time taken to add to db threads is :{0} ", stopwatch.Elapsed); }
public void GivenMultipleEmployeeDataToAddWithoutThreading_WhenDatabaseIsConnected_ShouldReturnTrueAndElapsedTime() { bool expected = true; // Act List <EmployeeModel> employeeList = AddingDataToList(); MultiThreadingOperations multiThreading = new MultiThreadingOperations(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); bool actual = multiThreading.AddMultipleEmployeeToDB(employeeList); stopwatch.Stop(); Console.WriteLine("Time taken to add to db without threads is :{0} ms", stopwatch.Elapsed); ///Assert Assert.AreEqual(expected, actual); }