public void should_check_result_store_for_existing_result() { var expectedResult = new TestConfigured(); _resultStore.Get <TestConfigured>().Returns(expectedResult); var result = _cut.Get <TestConfigured>(); result.Should().BeSameAs(expectedResult); _sourceResolver.DidNotReceive().Resolve <TestConfigured>(); }
public T Get <T>() where T : class, IConfigured, new() { var existingResult = _resultStore.Get <T>(); if (existingResult != null) { return(existingResult); } var configurationResult = _sourceResolver.Resolve <T>(); _resultStore.Store(configurationResult); return(configurationResult.Result); }