Example #1
0
        public void UserState()
        {
            var db      = new InMemoryDatabase();
            var uniform = UniformDatabase.Create(config => config
                                                 .RegisterDocuments(typeof(UserView).Assembly)
                                                 .RegisterDatabase(ViewDatabases.Mongodb, db));
            var viewDb = new ViewDatabase(uniform);

            viewDb.Users.Save(new UserView()
            {
                Id       = "me1",
                UserName = "******"
            });
            var storedUser = db.GetCollection <UserView>(ViewCollections.Users).GetById("me1");

            Assert.AreEqual("me1", storedUser.Id);
            Assert.AreEqual("User Name", storedUser.UserName);
        }