public void MWArray_GetFieldAsSingleItem_Bool_Input() { var f = "arrayfield"; var value = false; var sa = new MWStructArray(new int[] { 1 }, new string[] { f }); var na = new MWLogicalArray(value); sa[f] = na; Assert.That(MWArrayExtensions.GetFieldAsSingleItem <bool>(sa, f), Is.EqualTo(value)); }
public void MWArray_GetFieldAsSingleItem_Numeric_Input() { var f = "arrayfield"; var value = 42.42f; var sa = new MWStructArray(new int[] { 1 }, new string[] { f }); var na = new MWNumericArray(value); sa[f] = na; Assert.That(MWArrayExtensions.GetFieldAsSingleItem <double>(sa, f), Is.EqualTo(value)); }
public void MWArray_GetFieldAsSingleItem_Bool_Multiple_Input() { var f = "arrayfield"; bool first = 0 % 2 == 0; Array value = Enumerable.Range(0, 42).Select(i => i % 2 == 0).ToArray(); var sa = new MWStructArray(new int[] { 1 }, new string[] { f }); var na = new MWLogicalArray(value); sa[f] = na; Assert.That(MWArrayExtensions.GetFieldAsSingleItem <bool>(sa, f), Is.EqualTo(first)); }
public void MWArray_GetFieldAsSingleItem_Numeric_Multiple_Input() { var f = "arrayfield"; int first = 0; Array value = Enumerable.Range(first, 42).ToArray(); var sa = new MWStructArray(new int[] { 1 }, new string[] { f }); var na = new MWNumericArray(value); sa[f] = na; Assert.That(MWArrayExtensions.GetFieldAsSingleItem <double>(sa, f), Is.EqualTo(first)); }