public void Ctor_WhenStringNotOnFirstLevel_ThrowsSisoDbException() { var parent = StructurePropertyTestFactory.GetRawProperty <Container>("NestedWithString"); var idProperty = StructurePropertyTestFactory.GetRawProperty <StringDummy>("StructureId", parent); var ex = Assert.Throws <SisoDbException>(() => new IdAccessor(idProperty)); Assert.AreEqual(ExceptionMessages.IdAccessor_InvalidLevel, ex.Message); }
public void SetValue_WhenComplexType_CompexTypeIsAssigned() { const string newValue = "Test"; var item = new Item { SingleSubItem = null }; var subItemProp = StructurePropertyTestFactory.GetRawProperty <Item>("SingleSubItem"); var indexAccessor = IndexAccessorTestFactory.CreateFor(subItemProp); indexAccessor.SetValue(item, new SubItem { Value = newValue }); Assert.AreEqual(newValue, item.SingleSubItem.Value); }