public IServiceContext GetContext(IServiceProfile profile) { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } foreach (var builder in _builders) { var result = builder(_contextProvider, profile); if (result != null) { return(result); } } throw new InvalidOperationException( $"Cannot build context for profile of type '{profile.GetType().Name}'."); }
private IServiceContext GetContext(IServiceProfile profile) { foreach (var handler in ContextHandlers) { var result = handler(profile, _mockContext); if (result != null) { return(result); } } throw new InvalidOperationException($"Cannot find context for service profile type '{profile.GetType().Name}'."); }