Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public static void SetUp(TestContext context)
        {
            _memberFactory = new MemberFactory();
            _friendFactory = new FriendFactory();

            _member1 = _memberFactory.CreateMember("*****@*****.**");
            _member2 = _memberFactory.CreateMember("*****@*****.**");

            _friend = _friendFactory.CreateFriend(_member1, _member2);
        }
Ejemplo n.º 3
0
        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("*****@*****.**");
            _member2 = _memberDecorator.CreateMember("*****@*****.**");

            _friend = _friendDecorator.CreateFriend(_member1, _member2);
        }
Ejemplo n.º 4
0
        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;
            }
        }