public static void SetUp(TestContext context) { _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _gomeeTargetFactory = new TargetFactory(); using (var uow = new UnitOfWork()) { _me = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _he = _memberFactory.CreateMember(Guid.NewGuid().ToString()); uow.MemberRepository.Add(_me); uow.MemberRepository.Add(_he); _hisGomees = new List<Gomee>(); _mineGomees = new List<Gomee>(); _targets = new List<Target>(); var count = new Random().Next(2, 5); for (var i = 0; i < count; i++) { var mineGomee = _gomeeFactory.CreateGomee(_me); var mineTarget = _gomeeTargetFactory.CreateGomeeTarget(_me, mineGomee); var hisGome = _gomeeFactory.CreateGomee(_he); var hisTarget1 = _gomeeTargetFactory.CreateGomeeTarget(_me, hisGome); var hisTarget2 = _gomeeTargetFactory.CreateGomeeTarget(_me, hisGome); _mineGomees.Add(mineGomee); _hisGomees.Add(hisGome); _targets.Add(mineTarget); _targets.Add(hisTarget1); _targets.Add(hisTarget2); uow.GomeeRepository.Add(mineGomee); uow.GomeeRepository.Add(hisGome); uow.TargetRepository.Add(mineTarget); uow.TargetRepository.Add(hisTarget1); uow.TargetRepository.Add(hisTarget2); } uow.PersistAll(); } using (var uow = new UnitOfWork()) { var member = uow.MemberRepository.Get(_me.Id); _loadedGomees = uow.GomeeRepository.GetTheirsFor(member); } }
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) { _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) { _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); using (var uow = new UnitOfWork()) { _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); uow.MemberRepository.Add(_member); _gomees = new List<Gomee>(); var count = new Random().Next(2, 10); for (var i = 0; i < count; i++) { var gomee = _gomeeFactory.CreateGomee(_member); _gomees.Add(gomee); uow.GomeeRepository.Add(gomee); } uow.PersistAll(); } using (var uow = new UnitOfWork()) { var member = uow.MemberRepository.Get(_member.Id); _mineGomees = uow.GomeeRepository.GetMineFor(member); } }
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_gomeeTarget() { _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _gomeeTargetFactory = new TargetFactory(); _member = _memberFactory.CreateMember("*****@*****.**"); _gomee = _gomeeFactory.CreateGomee(_member); _gomeeTarget = _gomeeTargetFactory.CreateGomeeTarget(_member, _gomee); }
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("*****@*****.**"); _gomee = _gomeeFactory.CreateGomee(_member); _target = _targetDecorator.CreateTarget(_member, _gomee); }
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); } }