public static void SetUp(TestContext context) { _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); uow.PersistAll(); _oldCount = uow.GomeeRepository.Count(); } using (var uow = new UnitOfWork()) { uow.GomeeRepository.Remove(uow.GomeeRepository.Get(_gomee.Id)); uow.PersistAll(); _newCount = uow.GomeeRepository.Count(); try { _loadedGomee = uow.GomeeRepository.Get(_gomee.Id); } catch (ArgumentException) { _loadedGomee = null; } } }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _targetFactory = new TargetFactory(); _targetDecorator = new TargetDecorator(_targetFactory, _unitOfWork.TargetRepository); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); _targets = new List<Target>(); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); var count = new Random().Next(2, 5); for (var i = 0; i < count; i++) { var target = _targetFactory.CreateGomeeTarget(_member, _gomee); _targets.Add(target); uow.TargetRepository.Add(target); } uow.PersistAll(); } _loadedTargets = _targetDecorator.GetFor(_unitOfWork.GomeeRepository.Get(_gomee.Id)); }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _targetFactory = new TargetFactory(); _targetDecorator = new TargetDecorator(_targetFactory, _unitOfWork.TargetRepository); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); _target = _targetFactory.CreateGomeeTarget(_member, _gomee); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); uow.TargetRepository.Add(_target); uow.PersistAll(); _oldCount = uow.TargetRepository.Count(); } _targetDecorator.Remove(_unitOfWork.TargetRepository.Get(_target.Id)); _unitOfWork.PersistAll(); _newCount = _unitOfWork.TargetRepository.Count(); try { _loadedTarget = _unitOfWork.TargetRepository.Get(_target.Id); } catch (ArgumentException) { _loadedTarget = null; } }
public When_creating_gomee() { _memberFactory = new MemberFactory(); _member = _memberFactory.CreateMember("*****@*****.**"); _gomeeFactory = new GomeeFactory(); _gomee = _gomeeFactory.CreateGomee(_member); }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _gomeeDecorator = new GomeeDecorator(_gomeeFactory, _unitOfWork.GomeeRepository); _member = _memberFactory.CreateMember("*****@*****.**"); _gomee = _gomeeDecorator.CreateGomee(_member); }
public Target CreateGomeeTarget(Member member, Gomee gomee) { if (member == null) throw new ArgumentNullException("member"); if (gomee == null) throw new ArgumentNullException("gomee"); return new Target() { Member = member, Gomee = gomee, Created = DateTime.Now }; }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _gomeeDecorator = new GomeeDecorator(_gomeeFactory, _unitOfWork.GomeeRepository); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); uow.PersistAll(); } _loadedGomee = _gomeeDecorator.Get(_gomee.Id); }
public static void SetUp(TestContext context) { _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); using (var uow = new UnitOfWork()) { _oldCount = uow.GomeeRepository.Count(); uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); uow.PersistAll(); } using (var uow = new UnitOfWork()) { _newCount = uow.GomeeRepository.Count(); _loadedGomee = uow.GomeeRepository.Get(_gomee.Id); } }
public static void SetUp(TestContext context) { _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _targetFactory = new TargetFactory(); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); _target = _targetFactory.CreateGomeeTarget(_member, _gomee); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); uow.TargetRepository.Add(_target); uow.PersistAll(); } using (var uow = new UnitOfWork()) { _loadedTarget = uow.TargetRepository.Get(_target.Id); } }