示例#1
0
        public void f()
        {
            var workTime = WorkTimeTestUtils.CreateManual();

            _repository.Save(workTime);
            workTime.MarkPendingEventsAsHandled();

            for (int i = 0; i < 2; i++)
            {
                _uow.RegisterNew(workTime);

                workTime.StartManually();

                _uow.Save();

                var found = _repository.Find(workTime.User, DateTime.UtcNow);

                found.Started.Should().BeTrue();

                _uow.Rollback();

                found = _repository.Find(workTime.User, DateTime.UtcNow);

                found.Started.Should().BeFalse();
                _repository.CountForUser(workTime.User).Should().Be(1);
            }
        }
示例#2
0
 public void DiscardTempChanges()
 {
     Debug.Assert(WorkTime != null);
     Debug.WriteLine("Discarding temp changes");
     ResetLastEvents();
     foreach (var builders in _eventBuilders.Values)
     {
         builders.MouseEventBuilder.Reset();
         builders.KeyboardEventBuilder.Reset();
     }
     _allKeyboardBuilder.Reset();
     _allMouseBuilder.Reset();
     _uow.Rollback();
     _uow.Unregister(WorkTime);
 }