public void CanSaveNewTask() { var _taskRepository = new TaskRepository(_session); var savedTask = _taskRepository.SaveOrUpdate(DataGenerator.GetTask(_project, _user)); Assert.AreNotEqual(0, savedTask.TaskID); Assert.AreNotEqual(Guid.Empty, savedTask.Guid); }
public void CanUpdateExistingTask() { var _taskRepository = new TaskRepository(_session); var savedTask = _taskRepository.SaveOrUpdate(DataGenerator.GetTask(_project, _user)); var retrievedTask = _taskRepository.GetById(savedTask.TaskID); retrievedTask.TimeLeft = 1; var retrievedSavedTask = _taskRepository.SaveOrUpdate(retrievedTask); Assert.AreEqual(retrievedTask.Guid, retrievedSavedTask.Guid); Assert.AreEqual(1, retrievedSavedTask.TimeLeft); }
public void TestFixtureSetUp() { //Use In Memory database, open session and Build Schema inside In Memory database _dataSession = new DataSession(SQLiteConfiguration.Standard.InMemory()); _session = _dataSession.SessionFactory.OpenSession(); BuildSchema(_session, _dataSession.Configuration); //create user var plantRepository = new GenericRepository <User>(_session); _user = DataGenerator.GetUser(); _user = plantRepository.SaveOrUpdate(_user); //create customer var customer = DataGenerator.GetCustomer(_user); customer = new GenericRepository <Company>(_session).SaveOrUpdate(customer); //Create project under customer _project = DataGenerator.GetProject(_user, customer); _project = new GenericRepository <Project>(_session).SaveOrUpdate(_project); //add project to user _user.Projects.Add(_project); _user = plantRepository.SaveOrUpdate(_user); //create task var taskRepository = new TaskRepository(_session); _task = taskRepository.SaveOrUpdate(DataGenerator.GetTask(_project, _user)); //create timeEntryType var timeEntryTypeRepository = new TimeEntryTypeRepository(_session); _timeEntryType = timeEntryTypeRepository.SaveOrUpdate(DataGenerator.GetTimeEntryType(customer)); }