public void GetClone_Bins_SameInstances() { //arrange IUntypedRecord rec = new KeyValRecord(_items, _recNo, 1, 0, null, new Dictionary <string, object>(), new Dictionary <string, object>(), _typeDefs, _config, null, ActionOnDuplicateKey.IgnoreItem); //act var clone = rec.GetClone(); //assert clone.TraceBin.Should().NotBeNull(); clone.TraceBin.Should().BeSameAs(rec.TraceBin); clone.PropertyBin.Should().NotBeNull(); clone.PropertyBin.Should().BeSameAs(rec.PropertyBin); }
public void GetClone_SimpleValues_SameData() { //arrange var items = new IItem[] { KeyValItem.CreateItem("IDCD_ID", "71941", _typeDefs), KeyValItem.CreateItem("blah", "blahblah", _typeDefs), KeyValItem.CreateItem("I_num", 243, _typeDefs) }; var rec = new KeyValRecord(items, 15, 4, 0, null, null, null, _typeDefs, _config, null, ActionOnDuplicateKey.IgnoreItem); //act var clone = rec.GetClone(); //assert clone.Should().NotBeSameAs(rec); clone.Count.Should().Be(3); clone.RecNo.Should().Be(15); clone.SourceNo.Should().Be(4); clone.Keys[0].Should().Be("IDCD_ID"); clone.GetItem("IDCD_ID").Key.Should().Be("IDCD_ID"); clone[1].Should().Be("blahblah"); clone["blah"].Should().Be("blahblah"); clone[2].Should().Be(243); clone["I_num"].Should().Be(243); var keys = clone.Keys.ToList(); keys.Count.Should().Be(3); keys[0].Should().Be("IDCD_ID"); keys[1].Should().Be("blah"); keys[2].Should().Be("I_num"); var itms = clone.Items.ToList(); itms.Count.Should().Be(3); itms[0].Key.Should().Be("IDCD_ID"); itms[0].Value.Should().BeOfType(typeof(string)); itms[0].Value.Should().Be("71941"); itms[0].ItemDef.Type.Should().Be(ItemType.String); itms[1].Key.Should().Be("blah"); itms[1].Value.Should().BeOfType(typeof(string)); itms[1].Value.Should().Be("blahblah"); itms[1].ItemDef.Type.Should().Be(ItemType.String); itms[2].Key.Should().Be("I_num"); itms[2].Value.Should().BeOfType(typeof(int)); itms[2].Value.Should().Be(243); itms[2].ItemDef.Type.Should().Be(ItemType.Int); }