private void InitializeValue() { string serializedValue = _keyDataStore.GetValue(_propertyKey); if (!string.IsNullOrEmpty(serializedValue)) { Value = ConvertFromString(serializedValue); base.Save(); } }
public void Constructor_WhenValueIsCached_ParsesTheValueIntoAnInt() { // Arrange _keyDataStore.GetValue(_key) .Returns("1"); // Act _viewModel = new IntCachedPropertyDecorator(_keyDataStore, _key); // Assert Assert.Equal(1, _viewModel.Value); }
public void Constructor_WhenValueIsCached_SetsValue() { // Arrange _keyDataStore.GetValue(_key) .Returns("Game of Thrones"); // Act var viewModel = new StringCachedPropertyDecorator(_keyDataStore, _key); // Assert Assert.Equal("Game of Thrones", viewModel.Value); Assert.Equal("Game of Thrones", viewModel.OriginalValue); }