Using NSubstitue (version 1.5.0.0 )you can do as below. You can create an instance of Settings (or you can even create a fake instance), then return the fake SecureCache as below.
public class SettingsRepository : ISettingsRepository {
public SettingsRepository() { Settings = Settings.Default; }
public Settings Settings { get; set; }
}
public interface ISettingsRepository {
Settings Settings { get; set; }
}
public class Settings {
public Settings Default { get; set; }
public string SecureCache { get; set; }
}
[TestFixture]
public class TestClass
{
[Test]
public void Subject_Scenario_Expectation()
{
var repoStub = Substitute.For<ISettingsRepository>();
repoStub.Settings.Returns(new Settings() { SecureCache = "www.somepath.com" });
Assert.IsNotNull(repoStub.Settings);
Assert.IsNotNull(repoStub.Settings.SecureCache);
}
}