public void SameValuesAreEqual() { var id = 123; var foo1 = new IntId(id); var foo2 = new IntId(id); Assert.Equal(foo1, foo2); }
public void Can_Set_StringId_To_Value_Type() { var resource = new IntId { StringId = "1" }; Assert.Equal(1, resource.Id); }
public void DifferentTypesAreUnequal() { var bar = GeneratedId2.New(); var foo = new IntId(23); //Assert.NotEqual(bar, foo); // does not compile Assert.NotEqual((object)bar, (object)foo); }
public void Setting_StringId_To_Null_Sets_Id_As_Default() { var resource = new IntId { StringId = null }; Assert.Equal(0, resource.Id); }
public bool Match(int?id) { if (IntId == null) { throw new Exception("Match(int? id): IntId == null"); } return(IntId.Match(id)); }
public XmlDocument BuildXMLRepresentation(SimulationMsg cdlMsg, bool bDebug) { tree_xml = "<xml id=" + "\"" + IntId.ToString() + "\">\n\t" + BuildXMLRepresentationRecurse(cdlMsg, bDebug) + "\n</xml>"; XmlDocument docTree = new XmlDocument(); docTree.LoadXml(tree_xml); return(docTree); }
public void CanSerializeFromString() { var value = 123; var foo = new IntId(value); var serializedValue = JsonConvert.SerializeObject(value); var deserializedFoo = JsonConvert.DeserializeObject <IntId>(serializedValue); Assert.Equal(foo, deserializedFoo); }
public void CanSerializeToString() { var value = 123; var foo = new IntId(value); var serializedFoo = JsonConvert.SerializeObject(foo); var serializedString = JsonConvert.SerializeObject(value); Assert.Equal(serializedFoo, serializedString); }
public void OverloadsWorkCorrectly() { var id = 12; var same1 = new IntId(id); var same2 = new IntId(id); var different = new IntId(3); Assert.True(same1 == same2); Assert.False(same1 == different); Assert.False(same1 != same2); Assert.True(same1 != different); }
public static RefId CreateList(IId[] elements) { var list = RefId.CreateRefId(); var rawList = BareListId.CreateBareListId(); list.SetProperty(listId, rawList); for (int i = 0; i < elements.Length; i++) { rawList.SetProperty(IntId.CreateId(i), elements[i]); } return(list); }
public override int GetHashCode() { var hash = base.GetHashCode(); hash ^= Readonly.GetHashCode(); hash ^= IntId.GetHashCode(); hash ^= UIntId.GetHashCode(); hash ^= LongId.GetHashCode(); hash ^= ULongId.GetHashCode(); hash ^= ShortId.GetHashCode(); hash ^= UShortId.GetHashCode(); hash ^= DoulbeId.GetHashCode(); hash ^= ByteId.GetHashCode(); hash ^= CharId.GetHashCode(); hash ^= SByteId.GetHashCode(); hash ^= CharRef.GetHashCode(); hash ^= ByteRef.GetHashCode(); hash ^= SByteRef.GetHashCode(); hash ^= Int16Id.GetHashCode(); hash ^= UInt16Id.GetHashCode(); hash ^= Int32Id.GetHashCode(); hash ^= UInt32Id.GetHashCode(); hash ^= Int64Id.GetHashCode(); hash ^= UInt64Id.GetHashCode(); hash ^= DateTime.GetHashCode(); hash ^= TitleEnum.GetHashCode(); hash ^= ATitleEnum.GetHashCode(); hash ^= FirstName.GetHashCode(); hash ^= LastName.GetHashCode(); hash ^= Bool.GetHashCode(); hash ^= BoolRef.GetHashCode(); if (Array != null) { hash ^= Array.GetHashCode(); } if (Enumerable != null) { hash ^= Enumerable.GetHashCode(); } if (Father != null) { hash ^= Father.GetHashCode(); } if (Mother != null) { hash ^= Mother.GetHashCode(); } if (Hidden != null) { hash ^= Hidden.GetHashCode(); } return(hash); }
public void refresh() { // Debug.LogError("page" + page); if (page == 0) { _last.state = Button.State.Disable; } else { _last.state = Button.State.Enabled; } if (page + 1 >= max) { _next.state = Button.State.Disable; } else { _next.state = Button.State.Enabled; } _last.refresh(); _next.refresh(); _text.text = (page + 1).ToString() + "/" + max.ToString(); BookItem[] items = _offset.GetComponentsInChildren <BookItem>(); foreach (var item in items) { item.gameObject.SetActive(false); GameObject.Destroy(item.gameObject); } List <Transform> list = new List <Transform>(); for (int i = page * count; i < items_.Count && i < (page + 1) * count; ++i) { string item = items_[i]; var bi = GameObject.Instantiate(_phototype); bi.setText(item); bi.transform.parent = _offset.transform; bi.gameObject.SetActive(true); bi.transform.localScale = Vector3.one; bi.transform.localRotation = Quaternion.identity; bi.onSelected += doSelected; IntId id = bi.gameObject.AskComponent <IntId>(); id.value = i; } _offset.UpdateCollection(); }
private void refresh() { foreach (B button in buttons_) { GameObject.DestroyImmediate(button.gameObject); } buttons_.Clear(); for (int i = 0; i < list_.Count; ++i) { B button = GameObject.Instantiate(_phototype, this.transform, true); button.load(list_[i]); button.gameObject.SetActive(true); IntId id = button.gameObject.AskComponent <IntId>(); id.value = i; buttons_.Add(button); // button.transform.SetParent(this.transform); } _grid.UpdateCollection(); }
public CatalogResolver(string catalogReference) { Match matches = null; catalogReference = catalogReference.Trim(); if (Regex.IsMatch(catalogReference, REGEX_PROTOCOL)) { FullUrl = catalogReference; } matches = Regex.Match(catalogReference, REGEX_NUM_ID); if (matches.Success) { Id = matches.Groups[1].Value; } matches = Regex.Match(catalogReference, REGEX_MEK_ID); if (matches.Success) { MekId = matches.Groups[1].Value; Id = matches.Groups[2].Value; } matches = Regex.Match(catalogReference, REGEX_URL_ID); if (matches.Success) { UrlId = matches.Groups[1].Value; Id = matches.Groups[2].Value; } // Enforce 5-digit Ids if (Id != null && Id.Length < 5) { Id = IntId.ToString("D5"); } MekId = MekId ?? $"MEK-{Id}"; UrlId = UrlId ?? $"{Id.Substring(0, 3)}00/{Id}"; }
public Boolean UpdateUsers() { try { var parameters = new Dictionary <String, String>() { { "Id", IntId.ToString() }, { "Username", StrUsername }, { "Displayname", StrDisplayname }, { "EmpId", StrEmpId }, { "Status", StrStatus }, { "Category", StrCategory } }; InfoPCMS.db.executeInsertOrUpdate("spUpdateUsers", parameters); return(true); } catch (Exception ex) { throw ex; } return(false); }
public void GetStringId_Returns_Null_If_Object_Is_Default() { var resource = new IntId(); string stringId = resource.ExposedGetStringId(default);
public void doClicked(IntId id) { // Debug.LogError(id.value); onSelected?.Invoke(list_[id.value]); }
public void doSelected(IntId id) { onSelected?.Invoke(id.value); }