コード例 #1
0
        public void Use_Raven_Db_Embedded_For_Tests_With_Custom_Int_Key()
        {
            var documentStore = new EmbeddableDocumentStore()
            {
                RunInMemory = true
            };

            using (var repos = new RavenDbRepository <RavenTestCustomIntKey, int>(documentStore))
            {
                repos.Add(new RavenTestCustomIntKey()
                {
                    Name = "Jeff", Age = 33
                });
                repos.Add(new RavenTestCustomIntKey()
                {
                    Name = "Ben", Age = 53
                });                                                                // :)

                var items = repos.GetAll().ToList();

                items.Count.ShouldEqual(2);

                // this works but won't work if the primary key is [ClassName]Id instead of just Id
                var item1 = repos.Get(1);
                item1.Name.ShouldEqual("Jeff");

                var item2 = repos.Get(2);
                item2.Name.ShouldEqual("Ben");
            }
        }
コード例 #2
0
        public void Use_Raven_Db_Embedded_For_Tests()
        {
            var documentStore = new EmbeddableDocumentStore()
            {
                RunInMemory = true
            };

            using (var repos = new RavenDbRepository <RavenTestStringKey>(documentStore))
            {
                repos.Add(new RavenTestStringKey()
                {
                    Name = "Jeff", Age = 33
                });
                repos.Add(new RavenTestStringKey()
                {
                    Name = "Ben", Age = 53
                });                                                           // :)

                var items = repos.GetAll().ToList();

                items.Count.ShouldEqual(2);

                var item2 = repos.Get("RavenTestStringKeys/2");
                // is there a way we could allow them to just pass in 2 or the full string, or is that a bad idea
                item2.Name.ShouldEqual("Ben");
            }
        }
コード例 #3
0
        public void Use_Raven_Db_Embedded_For_Tests_With_Int_Key()
        {
            var documentStore = new EmbeddableDocumentStore() { RunInMemory = true };
            using (var repos = new RavenDbRepository<RavenTestIntKey, int>(documentStore))
            {
                repos.Add(new RavenTestIntKey() {Name = "Jeff", Age = 33});
                repos.Add(new RavenTestIntKey() {Name = "Ben", Age = 53}); // :)

                var items = repos.GetAll().ToList();

                items.Count.ShouldEqual(2);

                // this works but won't work if the primary key is [ClassName]Id instead of just Id
                var item1 = repos.Get(1);
                item1.Name.ShouldEqual("Jeff");

                var item2 = repos.Get(2);
                item2.Name.ShouldEqual("Ben");
            }
        }
コード例 #4
0
        public void Use_Raven_Db_Embedded_For_Tests()
        {
            var documentStore = new EmbeddableDocumentStore() {RunInMemory = true};
            using (var repos = new RavenDbRepository<RavenTestStringKey>(documentStore))
            {
                repos.Add(new RavenTestStringKey() {Name = "Jeff", Age = 33});
                repos.Add(new RavenTestStringKey() {Name = "Ben", Age = 53}); // :)

                var items = repos.GetAll().ToList();

                items.Count.ShouldEqual(2);

                var item2 = repos.Get("RavenTestStringKeys/2");
                    // is there a way we could allow them to just pass in 2 or the full string, or is that a bad idea
                item2.Name.ShouldEqual("Ben");
            }
        }