Esempio n. 1
0
        public async Task Crud_SpecialCharacters()
        {
            const string databaseName = "rebel0_$()+/-";
            var          rebels       = await _client.GetOrCreateDatabaseAsync <Rebel>(databaseName);

            Rebel luke = await rebels.AddAsync(new Rebel { Name = "Luke", Age = 19 });

            Assert.Equal("Luke", luke.Name);

            luke.Surname = "Skywalker";
            luke         = await rebels.AddOrUpdateAsync(luke);

            Assert.Equal("Skywalker", luke.Surname);

            luke = await rebels.FindAsync(luke.Id);

            Assert.Equal(19, luke.Age);

            await rebels.RemoveAsync(luke);

            luke = await rebels.FindAsync(luke.Id);

            Assert.Null(luke);

            await _client.DeleteDatabaseAsync(databaseName);
        }
Esempio n. 2
0
 public async Task InitializeAsync()
 {
     _client = new CouchClient("http://localhost:5984", c =>
                               c.UseBasicAuthentication("admin", "admin"));
     _rebels = await _client.GetOrCreateDatabaseAsync <Rebel>();
 }