public void Get_WhenGivenObject_ReturnsReflectiveType() { var cache = new ReflectiveCache(); var basicObject = new { DataItemID = 1, DataItemCurrentStatusID = 1, DataItemStatusID = 1, DateEffective = DateTime.Now }; var result = cache.Get(basicObject); Assert.AreEqual(typeof(ReflectiveType), result.GetType()); }
public void SetValue_WhenCalled_SetsProperty() { var cache = new ReflectiveCache(); var basicObject = new DataStatusItem { DataItemID = 1, DataItemCurrentStatusID = 1, DataItemStatusID = 1, DateEffective = DateTime.Now }; var type = cache.Get(basicObject); var prop = type.GetProperties().Where(x => x.Name == nameof(DataStatusItem.DataItemID)).First(); prop.SetValue(basicObject, 2); Assert.AreEqual(2, basicObject.DataItemID); }