public void ListRemove(T[] inputs) { var list = new SelfList <T>(); foreach (var input in inputs) { list.Add(input); } var rnd = new Random(list.Count); int i = rnd.Next(list.Count); list.Remove(inputs[i]); int index = 0; foreach (var output in list.GetAll()) { if (index == i) { index++; } Assert.AreEqual(inputs[index], output); Console.WriteLine($"{inputs[index]},{output}"); index++; } }
public void ListAdd(T[] inputs) { var list = new SelfList <T>(); foreach (var input in inputs) { list.Add(input); } foreach (var(output, index) in list.GetAll().Select((output, index) => (output, index))) { Assert.AreEqual(inputs[index], output); Console.WriteLine($"{inputs[index]},{output}"); } }
public void ListException(T[] inputs) { var list = new SelfList <T>(); foreach (var input in inputs) { list.Add(input); } Assert.That(() => { foreach (var(output, index) in list.GetAll().Select((output, index) => (output, index))) { list.Add(inputs[0]); } }, Throws.Exception.With.Message.EqualTo("列挙中にリストが変更されました。")); }
public void DeleteBeanAt(int index) { if (index >= _Beans.Count) { return; } Bean exist = _Beans[index]; if (null != exist && null != exist.Self && null != SelfList) { SelfList.RemoveChild(exist.Self); } _Beans.RemoveAt(index); Parent.Document.IsChanged = true; }
private static bool IsSelf(this IData data) { var type = data.DataSourceId.InterfaceType; if (!SelfList.ContainsKey(type)) { var foreignTypes = DataAttributeFacade.GetDataReferencePropertyInfoes(type).Select(d => d.TargetType); if (foreignTypes.Contains(type)) { SelfList[type] = true; } else { SelfList[type] = false; } } return(SelfList[type]); }