public void IsDynamicIsSameAsSpecifiedInConstructor(bool isDynamic) { ValueSequenceDataSet dataSet = new ValueSequenceDataSet(new object[] { "a" }, null, isDynamic); List<IDataItem> items = new List<IDataItem>(dataSet.GetItems(EmptyArray<DataBinding>.Instance, true)); Assert.AreEqual(isDynamic, items[0].IsDynamic); }
public void ItemsContainEmptyMetadataWhenParameterWasNull() { ValueSequenceDataSet dataSet = new ValueSequenceDataSet(new object[] { "a" }, null, false); List<IDataItem> items = new List<IDataItem>(dataSet.GetItems(EmptyArray<DataBinding>.Instance, true)); PropertyBag map = DataItemUtils.GetMetadata(items[0]); Assert.Count(0, map); }
public void ItemsContainSameMetadataAsSpecifiedInConstructor() { List<KeyValuePair<string, string>> metadataPairs = new List<KeyValuePair<string, string>>(); metadataPairs.Add(new KeyValuePair<string, string>("Foo", "Bar")); ValueSequenceDataSet dataSet = new ValueSequenceDataSet(new object[] { "a" }, metadataPairs, false); List<IDataItem> items = new List<IDataItem>(dataSet.GetItems(EmptyArray<DataBinding>.Instance, true)); PropertyBag map = DataItemUtils.GetMetadata(items[0]); Assert.Count(1, map); Assert.AreEqual("Bar", map.GetValue("Foo")); }
public void ItemsAreScalarDataItemsThatContainValuesAtBindingIndexZero() { ValueSequenceDataSet dataSet = new ValueSequenceDataSet(new object[] { "a", "b" }, null, false); List<IDataItem> items = new List<IDataItem>(dataSet.GetItems(EmptyArray<DataBinding>.Instance, true)); Assert.Count(2, items); Assert.AreEqual("a", items[0].GetValue(new DataBinding(0, null))); Assert.AreEqual("b", items[1].GetValue(new DataBinding(0, null))); Assert.IsInstanceOfType(typeof(ScalarDataItem<object>), items[0]); Assert.IsInstanceOfType(typeof(ScalarDataItem<object>), items[1]); }
public void ItemsEnumerationIsEmptyIfDynamicAndNotIncludingDynamicRows() { ValueSequenceDataSet dataSet = new ValueSequenceDataSet(new object[] { "a" }, null, true); List<IDataItem> items = new List<IDataItem>(dataSet.GetItems(EmptyArray<DataBinding>.Instance, false)); Assert.Count(0, items); }