public void SetSummary(Summary summary)
 {
     EnsureEmployeeWithSpecifiedLogin(summary.EmployeeDescription.Employee.Login);
     _db.SetSummary(summary);
 }
 public void RelationsFromSummaryMustExist()
 {
     Summary summary = new Summary();
     Dao.SetSummary(summary);
 }
 public void GetLastSummariesReturnsLastSummaries()
 {
     User user = new User { PublicUserInfo = new PublicUserInfo { Login = "******" } };
     Project project = new Project { Manager = user.PublicUserInfo };
     EmployeeDescription empDesc = new EmployeeDescription { Employee = user.PublicUserInfo, Project = project };
     Summary sum1 = new Summary { Date = new DateTime(2012, 10, 01), EmployeeDescription = empDesc };
     Summary sum2 = new Summary { Date = new DateTime(2012, 09, 01), EmployeeDescription = empDesc };
     Summary sum3 = new Summary { Date = new DateTime(2013, 01, 01), EmployeeDescription = empDesc };
     Dao.SetUser(user);
     Dao.SetProject(project);
     Dao.SetEmployeeDescription(empDesc);
     Dao.SetSummary(sum1);
     Dao.SetSummary(sum2);
     Dao.SetSummary(sum3);
     var sums = Dao.GetLastSummaries(empDesc, 2);
     Assert.AreEqual(sum3, sums[0]);
     Assert.AreEqual(sum1, sums[1]);
     Assert.AreEqual(2, sums.Count);
 }
 private void PrepareForRemoving(String Login)
 {
     PublicUserInfo userInfo = new PublicUserInfo() { Login = "******" };
     User user = new User() { PublicUserInfo = userInfo };
     Project project = new Project() { Manager = userInfo };
     EmployeeDescription employeeDescription = new EmployeeDescription() { Employee = userInfo, Project = project };
     Contract contract = new Contract() { Creator = userInfo, Employee = userInfo, Project = project };
     WorkRecord record = new WorkRecord { EmployeeDescription = employeeDescription, MinutesWorked = 12 };
     Summary summary = new Summary { EmployeeDescription = employeeDescription };
     Dao.SetUser(user);
     Assert.IsFalse(Dao.GetEmployeeDescriptions(user).Count > 0);
     Assert.IsFalse(Dao.GetRecords(user).Count > 0);
     Assert.IsFalse(Dao.GetSummaries(user).Count > 0);
     Assert.IsFalse(Dao.GetContracts(user).Count > 0);
     Dao.SetProject(project);
     Dao.SetEmployeeDescription(employeeDescription);
     Dao.SetRecord(record);
     Dao.SetSummary(summary);
     Dao.SetContract(contract);
     Assert.IsTrue(Dao.GetEmployeeDescriptions(user).Count > 0);
     Assert.IsTrue(Dao.GetRecords(user).Count > 0);
     Assert.IsTrue(Dao.GetContracts(user).Count > 0);
     Assert.IsTrue(Dao.GetSummaries(user).Count > 0);
 }