public async Task x011_ShouldChangeTheUniquePropertyOfUserDefinedColumn() { var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); var column1 = new CB.Column("Name1", CB.DataType.Text.ToString(), true, false); obj.AddColumn(column1); obj = await obj.SaveAsync(); obj.Columns.First(o => o.Name == "Name1").Unique = true; try { obj = await obj.SaveAsync(); Assert.IsFalse(true); } catch (CB.Exception.CloudBoostException e) { Console.WriteLine(e); Assert.IsTrue(true); } }
public async Task x005_ShouldUpdateANewColumnInATable() { var tableName1 = CB.Test.Util.Methods._makeString(); var tableName2 = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName1); var obj1 = new CB.CloudTable(tableName2); obj = await obj.SaveAsync(); obj1 = await obj1.SaveAsync(); obj = await CB.CloudTable.GetAsync(obj); var column1 = new CB.Column("Name11", CB.DataType.Relation.ToString(), true, false); column1.RelatedTo = tableName2; obj.AddColumn(column1); obj = await obj.SaveAsync(); var column2 = new CB.Column("Name11"); obj.DeleteColumn(column2); obj = await obj.SaveAsync(); Assert.IsTrue(true); }
public async Task x010_ShouldNotChangeTheRequiredPropertyOfDefaultColumn() { var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); var column1 = new CB.Column("Name1", CB.DataType.Text.ToString(), true, false); obj.AddColumn(column1); obj = await obj.SaveAsync(); obj.Columns.First(o => o.Name == "Name1").Required = false; try { obj = await obj.SaveAsync(); Assert.IsTrue(true); } catch (CB.Exception.CloudBoostException e) { Console.WriteLine(e); Assert.Fail("Cannot save a table when required of a column is changed."); } }
public async Task x009_ShouldNotChangeTheDataTypeOfAColumn() { var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); var table = await CB.CloudTable.GetAsync(obj); var column1 = new CB.Column("Name1", CB.DataType.Text.ToString(), true, false); table.AddColumn(column1); obj = await obj.SaveAsync(); obj.Columns.FirstOrDefault().DataType = CB.DataType.Number.ToString(); try { obj = await obj.SaveAsync(); Assert.IsFalse(true); } catch (CB.Exception.CloudBoostException e) { Console.WriteLine(e); Assert.IsTrue(true); } }
public async Task EqualToWithCloudSearchOverCloudObject() { var custom = new CB.CloudTable("CustomRelation"); var newColumn1 = new CB.Column("newColumn7"); newColumn1.DataType = CB.DataType.Relation.ToString(); custom.AddColumn(newColumn1); await custom.SaveAsync(); var loc = new CB.CloudGeoPoint(17.7, 80.0); var obj = new CB.CloudObject("CustomRelation"); var obj1 = new CB.CloudObject("student1"); obj1.Set("name", "Ranjeet"); obj.Set("newColumn7", obj1); await obj.SaveAsync(); var search = new CB.CloudSearch("CustomRelation"); search.SearchFilter = new CB.SearchFilter(); search.SearchFilter.EqualTo("newColumn7", obj.Get("newColumn7")); var list = (List <CB.CloudObject>) await search.Search(); if (list.Count > 0) { Assert.IsTrue(true); } else { Assert.Fail("should have retrieved data"); } }
public async Task getDataFromServerNearFunction() { var custom = new CB.CloudTable("CustomGeoPoint"); var newColumn7 = new CB.Column("location"); newColumn7.DataType = CB.DataType.GeoPoint.ToString(); custom.AddColumn(newColumn7); var response = await custom.SaveAsync(); var loc = new CB.CloudGeoPoint(17.7, 80.0); var obj = new CB.CloudObject("CustomGeoPoint"); obj.Set("location", loc); await obj.SaveAsync(); var search = new CB.CloudSearch("CustomGeoPoint"); search.SearchFilter = new CB.SearchFilter(); search.SearchFilter.Near("location", loc, 1); var list = (List <CB.CloudObject>) await search.Search(); if (list.Count > 0) { Assert.IsTrue(true); } else { Assert.Fail("should have retrieved data"); } }
public async Task x006_CreateDeleteTable() { Util.Keys.InitWithMasterKey(); var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); obj = await obj.SaveAsync(); obj = await obj.DeleteAsync(); Assert.IsTrue(true); }
public async Task x012_ShouldNotDeleteTheDefaultColumnOfTheTable() { var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); obj = await obj.SaveAsync(); obj.DeleteColumn(obj.Columns.Single(o => obj.Name == "Id")); try { obj = await obj.SaveAsync(); Assert.Fail("Cannot delete the default column"); } catch (CB.Exception.CloudBoostException e) { Console.WriteLine(e); Assert.IsTrue(true); } }
public async Task x007_CreateDeleteTable() { var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); var table = await CB.CloudTable.GetAsync(obj); var column1 = new CB.Column("city", CB.DataType.Text.ToString(), true, false); table.AddColumn(column1); obj = await obj.SaveAsync(); Assert.IsTrue(true); }
public async Task x005_CreateAddressTable() { Util.Keys.InitWithMasterKey(); var obj = new CB.CloudTable("Address"); var City = new CB.Column("City"); City.DataType = CB.DataType.Text.ToString(); var PinCode = new CB.Column("PinCode"); PinCode.DataType = CB.DataType.Number.ToString(); obj.AddColumn(City); obj.AddColumn(PinCode); obj = await obj.SaveAsync(); Assert.IsTrue(true); }
public async Task x004_CreateCompanyTable() { var obj = new CB.CloudTable("Company"); var Revenue = new CB.Column("Revenue"); Revenue.DataType = CB.DataType.Number.ToString(); var Name = new CB.Column("Name"); Name.DataType = CB.DataType.Text.ToString(); obj.AddColumn(Revenue); obj.AddColumn(Name); obj = await obj.SaveAsync(); Assert.IsTrue(true); }
public async Task x010_ShouldNotChangeTheUniquePropertyOfDefaultColumn() { var tableName = CB.Test.Util.Methods._makeString(); var obj = new CB.CloudTable(tableName); obj.Columns.First(o => o.Name == "id").Unique = false; try { obj = await obj.SaveAsync(); Assert.IsFalse(true); } catch (CB.Exception.CloudBoostException e) { Console.WriteLine(e); Assert.IsTrue(true); } }
public async Task x003_CreateEmployeeTable() { Util.Keys.InitWithMasterKey(); var age = new CB.Column("Age"); age.DataType = CB.DataType.Number.ToString(); var name = new CB.Column("Name"); name.DataType = CB.DataType.Text.ToString(); CB.CloudTable obj = new CB.CloudTable("Employee"); obj.AddColumn(age); obj.AddColumn(name); obj = await obj.SaveAsync(); Assert.IsTrue(true); }
public async Task x008_ShouldNotRenameATable() { var obj = new CB.CloudTable(tableName); obj = await CB.CloudTable.GetAsync(obj); obj.Name = "Sample"; try { obj = await obj.SaveAsync(); Assert.IsFalse(true); } catch (CB.Exception.CloudBoostException e) { Console.WriteLine(e); Assert.IsTrue(true); } }