public ProblemRepositoryTest()
        {
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType<Member>();

                x.Include<Member>()
                    .Setup(m => m.Id).Use<ObjectIdDataSource>()
                    .Setup(m => m.OpenId).Random(5, 10)
                    .Setup(m => m.UserName).Random(5, 7);

                x.Include<Problem>()
                    .Setup(p => p.Id).Use<ObjectIdDataSource>()
                    .Setup(p => p.Text).Use<LoremIpsumSource>()
                    .Setup(p => p.Title).Random(7, 12);

                x.Include<Response>()
                    .Setup(r => r.Text).Use<LoremIpsumSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            _session = factory.CreateSession();

            _conn = new DbConnexion("Test_LittleProblem");
            _problemRepository = new ProblemRepository(_conn);
            _problemCollection = _conn.Collection<Problem>(CollectionNames.Problem);
        }
        public ProblemRepositoryTest()
        {
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Member>();

                x.Include <Member>()
                .Setup(m => m.Id).Use <ObjectIdDataSource>()
                .Setup(m => m.OpenId).Random(5, 10)
                .Setup(m => m.UserName).Random(5, 7);

                x.Include <Problem>()
                .Setup(p => p.Id).Use <ObjectIdDataSource>()
                .Setup(p => p.Text).Use <LoremIpsumSource>()
                .Setup(p => p.Title).Random(7, 12);

                x.Include <Response>()
                .Setup(r => r.Text).Use <LoremIpsumSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            _session = factory.CreateSession();

            _conn = new DbConnexion("Test_LittleProblem");
            _problemRepository = new ProblemRepository(_conn);
            _problemCollection = _conn.Collection <Problem>(CollectionNames.Problem);
        }
示例#3
0
        public MembershipServiceTest()
        {
            IConnexion conn = new DbConnexion("Test_LittleProblem");

            _service = new MembershipService(conn);
            _members = conn.Collection <Member>(CollectionNames.Member);
        }
示例#4
0
        public MemberRepositoryTest()
        {
            IConnexion conn = new DbConnexion("Test_LittleProblem");

            _memberRepository = new MemberRepository(conn);
            _members          = conn.Collection <Member>(CollectionNames.Member);
        }
        public void GetCollectionFromConnexion()
        {
            IConnexion connexion = new DbConnexion();
            var collection = connexion.Collection<Member>(CollectionNames.Member);

            Assert.That(collection, Is.Not.Null);
            Assert.That(collection.Name, Is.EqualTo(CollectionNames.Member));
        }
        public void GetCollectionFromConnexion()
        {
            IConnexion connexion  = new DbConnexion();
            var        collection = connexion.Collection <Member>(CollectionNames.Member);

            Assert.That(collection, Is.Not.Null);
            Assert.That(collection.Name, Is.EqualTo(CollectionNames.Member));
        }
 public MembershipServiceTest()
 {
     IConnexion conn = new DbConnexion("Test_LittleProblem");
     _service = new MembershipService(conn);
     _members = conn.Collection<Member>(CollectionNames.Member);
 }
 public MemberRepositoryTest()
 {
     IConnexion conn = new DbConnexion("Test_LittleProblem");
     _memberRepository = new MemberRepository(conn);
     _members = conn.Collection<Member>(CollectionNames.Member);
 }
 public void SetUp()
 {
     _problemCollection.RemoveAll();
     _conn.Collection <Member>(CollectionNames.Member).RemoveAll();
 }