public void Tag_ModifyDataTypeTag_Accept() { var tag1 = new Tag("Title", "DbType", true); tag1.DataType = "OtherDbType"; Assert.True(tag1.DataType == "OtherDbType"); }
public void Tag_ModifyCanSortTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); tag1.CanSort = false; Assert.False(tag1.CanSort); }
public void Tag_ModifyTitleTag_Accept() { var tag1 = new Tag("Title", DbType.String, true); tag1.Value = "Chronicals Of Riddick"; // we should be able to modify tags, so when pulling back the value it should be changed Assert.True(tag1.Value == "Chronicals Of Riddick"); }
// add or modify a tag type within the database public static Response AddCustomTag(Tag type, bool overwrite) { Tag dbType = GetTagType(type.Id); string[] rows = { "id", "name", "can_search", "can_sort", "required", "data_type", }; string[] data = { type.Id.ToString(), type.Name, type.CanSearch.ToString(), type.CanSort.ToString(), type.Required ? "1" : "0", type.DataType, }; if (type.IsModifiable) { if (dbType == null) { bool success = Database.SimpleInsertQuery(_typesTable, rows, data); return (success) ? Response.Success : Response.FailedDatabase; } else if (overwrite) { // overwrite the old file if overwrite true bool success = Database.SimpleUpdateQuery(_tagsTable, "id", type.Id, rows, data); return (success) ? Response.Success : Response.FailedDatabase; } else { return Response.FailedOverwrite; } } else { throw new ArgumentException("Unmodifiable tag passed!"); } }
public void Tag_GetNameTag_Accept() { var tag1 = new Tag("Title", DbType.String, true); Assert.True(tag1.Name == "Title"); }
public void Tag_GetDatabaseType_Accept() { var tag1 = new Tag("Filetype", DbType.String, false); Assert.True(tag1.DatabaseType == DbType.String); }
public void Tag_GetNameTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); Assert.True(tag1.Name == "Title"); }
public void Tag_GetIdTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); Assert.True(tag1.Id == 0); }
public void Tag_GetIsModifiableTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); Assert.True(tag1.IsModifiable); }
public void Tag_GetCanSortTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); Assert.True(tag1.CanSort); }
public void Tag_GetDatabaseType_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); Assert.True(tag1.DataType == "DbType"); }
public void Tag_GetCanRequiredTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", true); Assert.True(tag1.Required); }
public void Tag_NotModifyValueTag_Accept() { var tag1 = new Tag("Title", "DbType", false); tag1.Value = "value"; Assert.True(tag1.Value == null); }
public void Tag_NotModifyTitleTag_Accept() { var tag1 = new Tag("Title", "DbType", false); tag1.Name = "Chronicals Of Riddick"; // we should not be able to modify tags, so when pulling back the value it should be changed Assert.True(tag1.Name == "Title"); }
public void Tag_NotModifyCanSearchTag_Accept() { var tag1 = new Tag(0, "Title", true, true, true, "DbType", false); tag1.CanSearch = false; Assert.True(tag1.CanSearch); }
public void Tag_ModifyValueTag_Accept() { var tag1 = new Tag("Title", "DbType", true); tag1.Value = "value"; Assert.True(tag1.Value == "value"); }