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 static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); var memberFactory = new MemberFactory(); _email = Guid.NewGuid().ToString(); _decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository); _oldCount = _unitOfWork.MemberRepository.Count(); _member = memberFactory.CreateMember(_email); _sameMember = memberFactory.CreateMember(_email); _decorator.Add(_member); _unitOfWork.PersistAll(); using (var uow = new UnitOfWork()) { _newCount = uow.MemberRepository.Count(); try { _loadedMember = uow.MemberRepository.Get(_member.Id); } catch (Exception) { _loadedMember = null; } } }
public void throws_ArgumentNullException_if_gomee_is_null() { using (var uof = new UnitOfWork()) { uof.GomeeRepository.Add(null); } }
public static void SetUp(TestContext context) { _memberFactory = new MemberFactory(); _friendFactory = new FriendFactory(); _member1 = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _member2 = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _friend = _friendFactory.CreateFriend(_member1, _member2); using (var uow = new UnitOfWork()) { _oldCount = uow.FriendRepository.Count(); uow.MemberRepository.Add(_member1); uow.MemberRepository.Add(_member2); uow.FriendRepository.Add(_friend); uow.PersistAll(); } using (var uow = new UnitOfWork()) { _newCount = uow.FriendRepository.Count(); _loadedFriend = uow.FriendRepository.Get(_friend.Id); } }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _factory = new MemberFactory(); _decorator = new MemberDecorator(_factory, _unitOfWork.MemberRepository); _member = _factory.CreateMember(Guid.NewGuid().ToString()); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.PersistAll(); _oldCount = uow.MemberRepository.Count(); } _decorator.Remove(_unitOfWork.MemberRepository.Get(_member.Id)); _unitOfWork.PersistAll(); _newCount = _unitOfWork.MemberRepository.Count(); try { _loadedMember = _unitOfWork.MemberRepository.Get(_member.Id); } catch (ArgumentException) { _loadedMember = 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 CleanUp() { using (var uow = new UnitOfWork()) { foreach (var target in _targets) { uow.TargetRepository.Remove(uow.TargetRepository.Get(target.Id)); } foreach (var gomee in _mineGomees) { uow.GomeeRepository.Remove(uow.GomeeRepository.Get(gomee.Id)); } foreach (var gomee in _hisGomees) { uow.GomeeRepository.Remove(uow.GomeeRepository.Get(gomee.Id)); } uow.MemberRepository.Remove(uow.MemberRepository.Get(_me.Id)); uow.MemberRepository.Remove(uow.MemberRepository.Get(_he.Id)); uow.PersistAll(); } }
public void throwsArgumentNullException_if_member_is_null() { using (var uof = new UnitOfWork()) { uof.MemberRepository.Remove(null); } }
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) { _memberFactory = new MemberFactory(); _friendFactory = new FriendFactory(); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _members = new List<Member>(); _friends = new List<Friend>(); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); var count = new Random().Next(2, 5); for (var i = 0; i < count; i++) { var member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); var friend = _friendFactory.CreateFriend(_member, member); _friends.Add(friend); _members.Add(member); uow.MemberRepository.Add(member); uow.FriendRepository.Add(friend); } uow.PersistAll(); } using (var uow = new UnitOfWork()) { var member = uow.MemberRepository.Get(_member.Id); _loadedFriends = uow.FriendRepository.GetFor(member); } }
public static void CleanUp() { using (var uow = new UnitOfWork()) { uow.MemberRepository.Remove(uow.MemberRepository.Get(_member.Id)); uow.PersistAll(); } }
public void throws_ArgumentException_if_member_with_specified_email_exist() { using (var uow = new UnitOfWork()) { var member = _memberFactory.CreateMember(_email); uow.MemberRepository.Add(member); } }
public MemberResponse AddMember(String email) { _serviceContext.ContentType = "text/html"; MemberResponse response = new MemberResponse(); IUnitOfWork uow = null; IMemberFactory factory = null; try { uow = new UnitOfWork(); factory = new MemberFactory(); var member = factory.CreateMember(email); uow.MemberRepository.Add(member); uow.PersistAll(); response.Id = member.Id; response.Email = member.Email; } catch (ArgumentNullException) { throw FaultFactory.CreateFaultException( new ArgumentFault() { Argument = "email", Message = String.Format( CultureInfo.InvariantCulture, Resources.CannotBeNullOrEmptyString_String, "Email", 0), Value = email }); } catch (ArgumentException) { throw FaultFactory.CreateFaultException( new ArgumentFault() { Argument = "email", Message = String.Format( CultureInfo.InvariantCulture, Resources.EntityAllreadyExist_String, "Member"), Value = email }); } finally { if (uow != null) { uow.Close(); } } return response; }
public static void CleanUp() { using (var uow = new UnitOfWork()) { foreach (var gomee in _gomees) { uow.GomeeRepository.Remove(uow.GomeeRepository.Get(gomee.Id)); } uow.MemberRepository.Remove(uow.MemberRepository.Get(_member.Id)); uow.PersistAll(); } }
public static void CleanUp() { using (var uow = new UnitOfWork()) { uow.TargetRepository.Remove(uow.TargetRepository.Get(_target.Id)); uow.GomeeRepository.Remove(uow.GomeeRepository.Get(_gomee.Id)); uow.MemberRepository.Remove(uow.MemberRepository.Get(_member.Id)); uow.PersistAll(); } _unitOfWork.Close(); }
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 FriendResponse AddFriend( Int32 memberId, Int32 friendMemberId) { _serviceContext.ContentType = "text/html"; FriendResponse response = new FriendResponse(); IUnitOfWork uow = null; IFriendFactory factory = null; try { uow = new UnitOfWork(); factory = new FriendFactory(); var member1 = uow.MemberRepository.Get(memberId); var member2 = uow.MemberRepository.Get(friendMemberId); var friend = factory.CreateFriend(member1, member2); uow.FriendRepository.Add(friend); uow.PersistAll(); response.Id = friend.Id; response.Member1Id = friend.Member1.Id; response.Member2Id = friend.Member2.Id; } catch (ArgumentException) { throw FaultFactory.CreateFaultException( new ArgumentFault() { Argument = "memberId", Message = String.Format( CultureInfo.InvariantCulture, Resources.EntityNotExist_String, "Member"), Value = memberId.ToString(CultureInfo.InvariantCulture) }); } finally { if (uow != null) { uow.Close(); } } return response; }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _factory = new MemberFactory(); _decorator = new MemberDecorator(_factory, _unitOfWork.MemberRepository); _member = _factory.CreateMember(Guid.NewGuid().ToString()); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.PersistAll(); } _loadedMember = _decorator.Get(_member.Id); }
public static void SetUp(TestContext context) { _memberFactory = new MemberFactory(); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.PersistAll(); } using (var uow = new UnitOfWork()) { _loadedMember = uow.MemberRepository.Get(_member.Id); } }
public static void CleanUp() { using (var uow = new UnitOfWork()) { foreach (var friend in _friends) { uow.FriendRepository.Remove(uow.FriendRepository.Get(friend.Id)); } foreach (var member in _members) { uow.MemberRepository.Remove(uow.MemberRepository.Get(member.Id)); } uow.MemberRepository.Remove(uow.MemberRepository.Get(_member.Id)); uow.PersistAll(); } }
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); _oldCount = _unitOfWork.GomeeRepository.Count(); _unitOfWork.MemberRepository.Add(_member); _gomeeDecorator.Add(_gomee); _unitOfWork.PersistAll(); using (var uow = new UnitOfWork()) { _newCount = uow.GomeeRepository.Count(); _loadedGomee = uow.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(); } _loadedTarget = _targetDecorator.Get(_target.Id); }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _memberDecorator = new MemberDecorator(new MemberFactory(), _unitOfWork.MemberRepository); _friendDecorator = new FriendDecorator(new FriendFactory(), _unitOfWork.FriendRepository); _member1 = _memberDecorator.CreateMember(Guid.NewGuid().ToString()); _member2 = _memberDecorator.CreateMember(Guid.NewGuid().ToString()); _friend = _friendDecorator.CreateFriend(_member1, _member2); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member1); uow.MemberRepository.Add(_member2); uow.FriendRepository.Add(_friend); uow.PersistAll(); _oldCount = uow.FriendRepository.Count(); } _friendDecorator.Remove(_unitOfWork.FriendRepository.Get(_friend.Id)); _unitOfWork.PersistAll(); _newCount = _unitOfWork.FriendRepository.Count(); try { _loadedFriend = _unitOfWork.FriendRepository.Get(_friend.Id); } catch (ArgumentException) { _loadedFriend = null; } }
public void throws_ArgumentNullException_if_member_is_null() { using (var uow = new UnitOfWork()) { uow.TargetRepository.GetFor((Member)null); } }
public void throws_ArgumentNullException_if_member_is_null() { using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(null); } }
public void throws_ArgumentException_when_target_not_exist() { using (var uow = new UnitOfWork()) { uow.TargetRepository.Get(0); } }
public void throws_ArgumentNullException_if_friend_is_null() { using (var uof = new UnitOfWork()) { uof.FriendRepository.Remove(null); } }
public void throws_ArgumentNullException_if_member_is_null() { using (var uow = new UnitOfWork()) { uow.GomeeRepository.GetMineFor(null); } }
public void throws_ArgumentException_when_gomee_not_exist() { using (var uow = new UnitOfWork()) { uow.GomeeRepository.Get(0); } }