public void Copy_Bool_AsIAttributeListCopier(int capacity, bool[] vals) { var mockMgr = new Mock<IAttributeMgr>(); mockMgr.Setup(foo => foo.Depth).Returns(capacity); AttributeList<bool> list1 = new AttributeList<bool>(mockMgr.Object); AttributeList<bool> list2 = new AttributeList<bool>(mockMgr.Object); Assert.AreEqual(capacity, list1.Count, "list1.Count should match capacity"); Assert.AreEqual(capacity, list2.Count, "list2.Count should match capacity"); for (int i = 0; i < vals.Length; i++) { list1[i] = vals[i]; } IAttributeListCopier copier = new AttributeListCopier(); copier.Copy(list1, list2); for (int i = 0; i < list1.Count; i++) { Assert.AreEqual(list2[i], list1[i], string.Format("Value [{0}] should match", i)); } }
public void Copy_ThrowsWhenDataTypesDoNotMatch_AsIAttributeListCopier() { int capacity = 2; var mockMgr = new Mock<IAttributeMgr>(); mockMgr.Setup(foo => foo.Depth).Returns(capacity); AttributeList<int> list1 = new AttributeList<int>(mockMgr.Object); AttributeList<double> list2 = new AttributeList<double>(mockMgr.Object); IAttributeListCopier copier = new AttributeListCopier(); copier.Copy(list1, list2); }
public void Copy_ThrowsWhenTargListIsNull_AsIAttributeListCopier() { int capacity = 2; var mockMgr = new Mock<IAttributeMgr>(); mockMgr.Setup(foo => foo.Depth).Returns(capacity); AttributeList<string> list1 = new AttributeList<string>(mockMgr.Object); AttributeList<string> list2 = null; IAttributeListCopier copier = new AttributeListCopier(); copier.Copy(list1, list2); }
public void Copy_ThrowsWhenCountsDoNotMatch_AsIAttributeListCopier() { int capacity1 = 3; int capacity2 = 2; var mockMgr1 = new Mock<IAttributeMgr>(); var mockMgr2 = new Mock<IAttributeMgr>(); mockMgr1.Setup(foo => foo.Depth).Returns(capacity1); mockMgr2.Setup(foo => foo.Depth).Returns(capacity2); AttributeList<int> list1 = new AttributeList<int>(mockMgr1.Object); AttributeList<int> list2 = new AttributeList<int>(mockMgr2.Object); IAttributeListCopier copier = new AttributeListCopier(); copier.Copy(list1, list2); }