Exemplo n.º 1
0
        public void GetAllKeys()
        {
            var client = MockSetup.GetClient();
            var users  = client.DB().GetAllKeysAsync <User>().Result;

            Assert.Equal(2, users.Count());
        }
Exemplo n.º 2
0
        public void DefaultClientBehavior()
        {
            var client = MockSetup.GetClient();

            // should always be available after SetDefaultDatabase
            Assert.NotNull(client.DB());
        }
Exemplo n.º 3
0
        public void AQLSelectEntity()
        {
            var client = MockSetup.GetClient();
            var user   = client.DB().Query <User>("for u in User return u").Result.First();

            Assert.IsType <User>(user);
        }
Exemplo n.º 4
0
        public void CreateDatabase()
        {
            var       client   = MockSetup.GetClient();
            MockSetup newsetup = new MockSetup();
            var       dbs      = newsetup.settings;

            //dbs.DatabaseName = "newtest";

            // non-existant database should be created and returned
            Assert.IsType <ArangoDatabase>(client.InitDB(dbs));
        }
Exemplo n.º 5
0
        public void UpdateAsync()
        {
            var client = MockSetup.GetClient();

            var id   = "1312460";
            var user = new User()
            {
                Password = "******",
                Username = "******"
            };

            var updated     = client.DB().UpdateAsync(id, user).Result;
            var updatedUser = updated.New;

            Assert.IsType <User>(user);
            Assert.Equal("newpass", updatedUser.Password);
        }
Exemplo n.º 6
0
        public void CRUDMethods()
        {
            var client = MockSetup.GetClient();

            var id   = "1312460";
            var user = new User()
            {
                Password = "******",
                Username = "******"
            };

            var inserted = client.DB().InsertAsync(user).Result;

            var insertUser = inserted.New;

            Assert.IsType <User>(user);
            Assert.Equal("jdoe", insertUser.Username);
            Assert.Equal("passcode", insertUser.Password);
            Assert.Equal(id, inserted.Key);
        }
Exemplo n.º 7
0
        public void DeleteAsync()
        {
            var client = MockSetup.GetClient();

            Assert.True(client.DB().DeleteAsync <User>("1127162").Result);
        }
Exemplo n.º 8
0
        public void GetByKeyAsync()
        {
            var client = MockSetup.GetClient();

            Assert.NotNull(client.DB().GetByKeyAsync <User>("1312460").Result);
        }