Here are the examples of the csharp api System.Threading.Tasks.Task.FromResult(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1190 Examples
19
Source : StaticStrategy.cs
with MIT License
from alonsoalon
with MIT License
from alonsoalon
public async Task<string> GetIdentifierAsync(object context)
{
return await Task.FromResult(identifier);
}
19
Source : AppBase.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public Task<string> OnInstantiateGetStartEvent()
{
_logger.LogInformation("OnInstantiate: GetStartEvent");
// return start event
return Task.FromResult("StartEvent_1");
}
19
Source : SecretsLocalAppSI.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public async Task<string> GetSecretAsync(string secretId)
{
string path = Path.Combine(Directory.GetCurrentDirectory(), @"secrets.json");
if (File.Exists(path))
{
string jsonString = File.ReadAllText(path);
JObject keyVault = JObject.Parse(jsonString);
keyVault.TryGetValue(secretId, out JToken token);
return token != null ? token.ToString() : string.Empty;
}
return await Task.FromResult(string.Empty);
}
19
Source : EventsMockSI.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public async Task<string> AddEvent(string eventType, Instance instance)
{
return await Task.FromResult(eventType);
}
19
Source : InstanceEventAppSIMock.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public Task<string> SaveInstanceEvent(object dataToSerialize, string org, string app)
{
return Task.FromResult("mocked");
}
19
Source : PolicyRepositoryMock.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public Task<string> TryAcquireBlobLease(string filepath)
{
if (filepath.Contains("error/blobstoragegetleaselockfail"))
{
return Task.FromResult((string)null);
}
return Task.FromResult("CorrectLeaseId");
}
19
Source : IGiteaMock.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn
with BSD 3-Clause "New" or "Revised" License
from Altinn
public Task<string> GetUserNameFromUI()
{
return Task.FromResult("testUser");
}
19
Source : TestAccessTokenApiClient.cs
with MIT License
from ansel86castro
with MIT License
from ansel86castro
public Task<string> GetClientCredentialsTokenAsync(string clientId, string clientSecret, string scope)
{
if (clientId == "TEST")
return Task.FromResult("TEST");
throw new InvalidOperationException("INVALID CLIENT");
}
19
Source : CodeSnippetService.cs
with MIT License
from apexcharts
with MIT License
from apexcharts
public Task<string> GetCodeSnippet(string clreplacedName)
{
return Task.FromResult("Source code view is disabled");
}
19
Source : CodeSnippetService.cs
with MIT License
from apexcharts
with MIT License
from apexcharts
public async Task<string> GetCodeSnippet(string clreplacedName)
{
var basePath = Directory.GetParent(replacedembly.GetExecutingreplacedembly().Location).Parent.Parent.Parent.Parent.FullName;
const string projectName = "BlazorApexCharts.Docs.";
var clreplacedPath = projectName + clreplacedName.Substring(projectName.Length-1).Replace(".", @"\");
var codePath = Path.Combine(basePath, $"{clreplacedPath}.razor");
if (File.Exists(codePath))
{
return await Task.FromResult(File.ReadAllText(codePath));
}
else
{
return await Task.FromResult($"Unable to find code at {codePath}");
}
}
19
Source : Program.cs
with Apache License 2.0
from AppMetrics
with Apache License 2.0
from AppMetrics
private static void ConfigureMetrics(IServiceCollection services)
{
services
.AddMetrics(options =>
{
options.ReportingEnabled = true;
options.GlobalTags.Add("env", "stage");
})
.AddHealthChecks(factory =>
{
factory.RegisterProcessPrivateMemorySizeHealthCheck("Private Memory Size", 200);
factory.RegisterProcessVirtualMemorySizeHealthCheck("Virtual Memory Size", 200);
factory.RegisterProcessPhysicalMemoryHealthCheck("Working Set", 200);
factory.Register("DatabaseConnected", () => Task.FromResult("Database Connection OK"));
factory.Register("DiskSpace", () =>
{
var freeDiskSpace = GetFreeDiskSpace();
return Task.FromResult(freeDiskSpace <= 512
? HealthCheckResult.Unhealthy("Not enough disk space: {0}", freeDiskSpace)
: HealthCheckResult.Unhealthy("Disk space ok: {0}", freeDiskSpace));
});
})
.AddReporting(factory =>
{
factory.AddConsole(new ConsoleReporterSettings
{
ReportInterval = TimeSpan.FromSeconds(5),
});
factory.AddTextFile(new TextFileReporterSettings
{
ReportInterval = TimeSpan.FromSeconds(30),
FileName = @"C:\metrics\sample.txt"
});
var influxFilter = new DefaultMetricsFilter()
.WhereMetricTaggedWithKeyValue(new TagKeyValueFilter { { "reporter", "influxdb" } })
.WithHealthChecks(true)
.WithEnvironmentInfo(true);
factory.AddInfluxDb(new InfluxDBReporterSettings
{
HttpPolicy = new HttpPolicy
{
FailuresBeforeBackoff = 3,
BackoffPeriod = TimeSpan.FromSeconds(30),
Timeout = TimeSpan.FromSeconds(3)
},
InfluxDbSettings = new InfluxDBSettings("appmetrics", new Uri("http://127.0.0.1:8086")),
ReportInterval = TimeSpan.FromSeconds(5)
}, influxFilter);
});
}
19
Source : OAuthService.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public Task<string> SignInTo(OAuthType socialType)
{
return Task.FromResult(string.Empty);
}
19
Source : DefaultMetricsRouteNameResolver.cs
with Apache License 2.0
from AppMetrics
with Apache License 2.0
from AppMetrics
public Task<string> ResolveMatchingTemplateRouteAsync(RouteData routeData)
{
var templateRoute = routeData.Routers.FirstOrDefault(r => r.GetType().Name == "Route")
as Route;
var controller = routeData.Values.FirstOrDefault(v => v.Key == "controller");
var action = routeData.Values.FirstOrDefault(v => v.Key == "action");
var version = routeData.Values.FirstOrDefault(v => v.Key == "version");
var result = string.Empty;
if (templateRoute != null)
{
result = templateRoute.ToTemplateString(
controller.Value as string,
action.Value as string,
version.Value == null ? string.Empty : version.Value as string);
}
return Task.FromResult(result);
}
19
Source : ReservoirsController.cs
with Apache License 2.0
from AppMetrics
with Apache License 2.0
from AppMetrics
[HttpGet("high-dynamic-range")]
public async Task<string> HdrHistogram()
{
//using (_metrics.Measure.Timer.Time(MetricsRegistry.TimerUsingHdrHistogramReservoir))
//{
// await Delay();
//}
return await Task.FromResult("OK");
}
19
Source : ApplePayService.cs
with Apache License 2.0
from AppRopio
with Apache License 2.0
from AppRopio
public Task<string> Pay(PaymentOrderInfo info, Action authorizationCallback = null)
{
if (info == null)
return Task.FromResult(string.Empty);
_tcs = new TaskCompletionSource<string>();
var request = new PKPaymentRequest();
request.MerchantIdentifier = Config.MerchantId;
request.SupportedNetworks = Config.SupportedNetworks.Select(n => new NSString(n)).ToArray();
request.MerchantCapabilities = PKMerchantCapability.ThreeDS;
request.CountryCode = Config.CountryCode;
request.CurrencyCode = info.Currency;
var paymenreplacedems = new List<PKPaymentSummaryItem>();
if (!info.Items.IsNullOrEmpty())
paymenreplacedems = info.Items.Select(item => new PKPaymentSummaryItem()
{
Label = item.replacedle,
Amount = new NSDecimalNumber(item.Amount.ToString())
}).ToList();
//добавляем итоговую стоимость
paymenreplacedems.Add(new PKPaymentSummaryItem()
{
Label = Mvx.IoCProvider.Resolve<ILocalizationService>().GetLocalizableString(ApplePayConstants.RESX_NAME, "Payment_Sum"),
Amount = new NSDecimalNumber(info.Amount.ToString())
});
request.PaymentSummaryItems = paymenreplacedems.ToArray();
var paymentViewController = new PKPaymentAuthorizationController(request);
paymentViewController.Delegate = this;
paymentViewController.Present(null);
return _tcs.Task;
}
19
Source : EventGridAuthorizationAttribute.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
protected virtual Task<string> GetAuthenticationSecret()
{
return Task.FromResult(_authenticationKeySecret);
}
19
Source : ConfigurationSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name to look up the secret configuration value");
string secretValue = _configuration[secretName];
return Task.FromResult(secretValue);
}
19
Source : CommandLineSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name to look up the command line argument secret");
if (_configurationProvider.TryGet(secretName, out string secretValue))
{
return Task.FromResult(secretValue);
}
return Task.FromResult<string>(null);
}
19
Source : DockerSecretsSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name to retrieve a Docker secret");
if (_provider.TryGet(secretName, out string value))
{
return Task.FromResult(value);
}
return Task.FromResult<string>(null);
}
19
Source : UserSecretsSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name to look up the user secret value");
if (_jsonProvider.TryGet(secretName, out string value))
{
return Task.FromResult(value);
}
return Task.FromResult<string>(null);
}
19
Source : InMemoryTestApiStartup.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration
{
IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always
};
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
app.UseWebApi(config);
if (!string.IsNullOrEmpty(SecretKey))
{
DynamicEventGridAuthorizationAttribute.RetrieveAuthenticationSecret = () => Task.FromResult(SecretKey);
}
}
19
Source : AzureServiceBusMessagePumpSettingsTests.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
[Fact]
public void CreateSettings_WithEnreplacedyScopedUsingConnectionString_Succeeds()
{
// Arrange
var enreplacedyType = ServiceBusEnreplacedyType.Queue;
var options = new AzureServiceBusMessagePumpOptions();
var serviceProvider = new ServiceCollection().BuildServiceProvider();
var namespaceConnectionString =
$"Endpoint=sb://arcus-messaging-integration-tests.servicebus.windows.net/;SharedAccessKeyName=MyAccessKeyName;SharedAccessKey={Guid.NewGuid()}";
// Act / replacedert
var settings = new AzureServiceBusMessagePumpSettings(
enreplacedyName: null,
subscriptionName: null,
serviceBusEnreplacedy: enreplacedyType,
getConnectionStringFromConfigurationFunc: null,
getConnectionStringFromSecretFunc: secretProvider => Task.FromResult(namespaceConnectionString),
options: options,
serviceProvider: serviceProvider);
}
19
Source : InMemorySecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
Guard.NotNull(secretName, "Secret name cannot be 'null'");
if (_secretValueByName.TryGetValue(secretName, out string secretValue))
{
return Task.FromResult(secretValue);
}
return Task.FromResult<string>(null);
}
19
Source : AzureServiceBusMessagePumpSettingsTests.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
[Fact]
public async Task GetEnreplacedyPath_WithNamespaceConnectionStringInsteadOfEnreplacedyScopedUsingConnectionString_Fails()
{
// Arrange
var enreplacedyType = ServiceBusEnreplacedyType.Queue;
var options = new AzureServiceBusMessagePumpOptions();
var secretProvider = new EnvironmentVariableSecretProvider();
var serviceProvider = new ServiceCollection()
.AddSingleton<ISecretProvider>(secretProvider)
.BuildServiceProvider();
var namespaceConnectionString =
$"Endpoint=sb://arcus-messaging-integration-tests.servicebus.windows.net/;SharedAccessKeyName=MyAccessKeyName;SharedAccessKey={Guid.NewGuid()}";
var settings = new AzureServiceBusMessagePumpSettings(
enreplacedyName: null,
subscriptionName: null,
serviceBusEnreplacedy: enreplacedyType,
getConnectionStringFromConfigurationFunc: null,
getConnectionStringFromSecretFunc: secretProvider => Task.FromResult(namespaceConnectionString),
options: options,
serviceProvider: serviceProvider);
// Act
await replacedert.ThrowsAnyAsync<ArgumentException>(() => settings.GetEnreplacedyPathAsync());
}
19
Source : EnvironmentVariableSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
Guard.NotNullOrWhitespace(secretName, nameof(secretName), "Requires a non-blank secret name to look up the environment secret");
string environmentVariable = Environment.GetEnvironmentVariable(_prefix + secretName, _target);
return Task.FromResult(environmentVariable);
}
19
Source : SingleValueHashiCorpSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public override Task<string> GetRawSecretAsync(string secretName)
{
return Task.FromResult(_secretValue);
}
19
Source : SpyKeyVaultSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public override Task<string> GetRawSecretAsync(string secretName)
{
GetRawSecretCalls++;
return Task.FromResult(secretName);
}
19
Source : SingleValueSecretProvider.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetRawSecretAsync(string secretName)
{
return Task.FromResult(_value);
}
19
Source : ConfigurationValidationLocation.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetExpectedCertificateValueForConfiguredKeyAsync(string configurationKey, IServiceProvider services)
{
try
{
Guard.NotNullOrWhitespace(configurationKey, nameof(configurationKey), "Configured key cannot be blank");
Guard.NotNull(services, nameof(services), "Registered services cannot be 'null'");
var configuration = services.GetService<IConfiguration>();
if (configuration == null)
{
throw new KeyNotFoundException(
$"No configured {nameof(IConfiguration)} implementation found in the request service container. "
+ "Please configure such an implementation (ex. in the Startup) of your application");
}
string value = configuration[configurationKey];
return Task.FromResult(value);
}
catch (Exception ex)
{
return Task.FromException<string>(ex);
}
}
19
Source : StubX509ValidationLocation.cs
with MIT License
from arcus-azure
with MIT License
from arcus-azure
public Task<string> GetExpectedCertificateValueForConfiguredKeyAsync(string configurationKey, IServiceProvider services)
{
return Task.FromResult(_stubbedValue);
}
19
Source : UriVideoSourceHandler.cs
with MIT License
from arqueror
with MIT License
from arqueror
public Task<string> LoadVideoAsync(VideoSource source, CancellationToken cancellationToken = default(CancellationToken))
{
string path = null;
var uriVideoSource = source as UriVideoSource;
if (uriVideoSource?.Uri != null)
{
path = uriVideoSource.Uri.AbsoluteUri;
}
return Task.FromResult(path);
}
19
Source : GenericControllerFeatureProviderTests.cs
with MIT License
from Artem-Romanenia
with MIT License
from Artem-Romanenia
public Task<string> Handle(GetTestDataRequest request, CancellationToken cancellationToken)
{
return Task.FromResult("From Handle!");
}
19
Source : RemotePlayApiClient.cs
with Apache License 2.0
from artemshuba
with Apache License 2.0
from artemshuba
public Task<string> ProcessCommandAsync(RemoteKitCommand command)
{
switch (command.Command.ToLower())
{
case "player.play":
AudioService.Instance.Play();
break;
case "player.pause":
AudioService.Instance.Pause();
break;
case "player.next":
AudioService.Instance.SwitchNext();
break;
case "player.prev":
AudioService.Instance.SwitchPrev();
break;
}
return Task.FromResult(string.Empty);
}
19
Source : UriVideoSourceHandler.cs
with MIT License
from arqueror
with MIT License
from arqueror
public async Task<string> LoadVideoAsync(VideoSource source, CancellationToken cancellationToken = default(CancellationToken))
{
string path = null;
var uriVideoSource = source as UriVideoSource;
if (uriVideoSource?.Uri != null)
{
path = uriVideoSource.Uri.AbsoluteUri;
}
return await Task.FromResult(path);
}
19
Source : DeploymentCatalogTests.cs
with MIT License
from aslotte
with MIT License
from aslotte
[TestMethod]
public async Task DeployModelToContainerAsync_ShouldCallDeployContainerAsync()
{
//Arrange
var deploymentTarget = new DeploymentTarget("Test");
var registeredModel = new RegisteredModel();
this.dockerContextMock.Setup(x => x.ComposeImageName(It.IsAny<string>(), It.IsAny<RegisteredModel>()))
.Returns("imagetag");
this.experimentRepositoryMock.Setup(x => x.GetExperiment(It.IsAny<Guid>()))
.Returns(new Experiment(experimentName: "MyExperiment"));
this.kubernetesContextMock.Setup(x => x.CreateNamespaceAsync(It.IsAny<string>(), It.IsAny<DeploymentTarget>()))
.Returns(Task.FromResult("myexperiment-test"));
//Act
await sut.DeployModelToKubernetesAsync<ModelInput, ModelOutput>(deploymentTarget, registeredModel, "registeredBy");
//Arrange
this.kubernetesContextMock.Verify(x => x.DeployContainerAsync("MyExperiment", "imagetag", "myexperiment-test"), Times.Once());
}
19
Source : DeploymentCatalogTests.cs
with MIT License
from aslotte
with MIT License
from aslotte
[ExpectedException(typeof(ModelSchemaNotRegisteredException))]
[TestMethod]
public async Task DeployModelToContainerAsync_WithoutRegisteredSchema_ShouldThrowException()
{
//Arrange
var deploymentTarget = new DeploymentTarget("Test");
var registeredModel = new RegisteredModel();
var run = new Run(Guid.NewGuid())
{
ModelSchemas = new List<ModelSchema>()
};
this.dockerContextMock.Setup(x => x.ComposeImageName(It.IsAny<string>(), It.IsAny<RegisteredModel>()))
.Returns("imagetag");
this.experimentRepositoryMock.Setup(x => x.GetExperiment(It.IsAny<Guid>()))
.Returns(new Experiment(experimentName: "MyExperiment"));
this.runRepositoryMock.Setup(x => x.GetRun(It.IsAny<Guid>()))
.Returns(run);
this.kubernetesContextMock.Setup(x => x.CreateNamespaceAsync(It.IsAny<string>(), It.IsAny<DeploymentTarget>()))
.Returns(Task.FromResult("myexperiment-test"));
//Act
await sut.DeployModelToKubernetesAsync(deploymentTarget, registeredModel, "registeredBy");
}
19
Source : TrainingCatalogTests.cs
with MIT License
from aslotte
with MIT License
from aslotte
[TestMethod]
public async Task MLOpsContext_ShouldCallLogHyperParameterIfPreplacededATrainerObject()
{
// Arrange
var mlContext = new MLContext(seed: 2);
var trainer = mlContext.BinaryClreplacedification.Trainers.LbfgsLogisticRegression(labelColumnName: "Sentiment", featureColumnName: "Features");
hyperParameterRepositoryMock.Setup(s => s.LogHyperParameterAsync(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(""));
// Act
await sut.LogHyperParametersAsync(new Guid(), trainer);
// replacedert
hyperParameterRepositoryMock.Verify(c => c.LogHyperParameterAsync(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>()), Times.AtLeastOnce);
}
19
Source : TrainingCatalogTests.cs
with MIT License
from aslotte
with MIT License
from aslotte
[TestMethod]
public async Task MLOpsContext_ShouldNotCallLogHyperParameterIfPreplacededNotATrainerObject()
{
// Arrange
var mlContext = new MLContext(seed: 2);
hyperParameterRepositoryMock.Setup(s => s.LogHyperParameterAsync(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(""));
var notTrainer = new NotTrainer();
// Act
await sut.LogHyperParametersAsync(new Guid(), notTrainer);
// replacedert
hyperParameterRepositoryMock.Verify(c => c.LogHyperParameterAsync(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never);
}
19
Source : KubernetesContextTests.cs
with MIT License
from aslotte
with MIT License
from aslotte
[TestMethod]
public async Task DeployContainerAsync_ShouldConstructExternalIPAddressCorrectly()
{
//Arrange
var experimentName = "experiment";
var deploymentTarget = new DeploymentTarget("Test");
var imageName = "image123";
var namespaceName = "experiment-test";
this.mockCliExecutor.Setup(x => x.GetServiceExternalIPAsync(kubernetesSettings, experimentName, namespaceName))
.Returns(Task.FromResult("127.0.0.1"));
//Act
var externalIp = await this.sut.DeployContainerAsync(experimentName, imageName, namespaceName);
//replacedert
externalIp.Should().Be("http://127.0.0.1/api/Prediction");
}
19
Source : DefaultUrlShortener.cs
with GNU Affero General Public License v3.0
from asmejkal
with GNU Affero General Public License v3.0
from asmejkal
public Task<string> ShortenAsync(string url) => Task.FromResult(url);
19
Source : AspNetAuthSessionStore.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public Task<string> StoreAsync(AuthenticationTicket ticket)
{
string key = Guid.NewGuid().ToString();
HttpContext httpContext = HttpContext.Current;
CheckSessionAvailable(httpContext);
httpContext.Session[key + ".Ticket"] = ticket;
return Task.FromResult(key);
}
19
Source : InMemoryAuthSessionStore.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public Task<string> StoreAsync(AuthenticationTicket ticket)
{
string key = Guid.NewGuid().ToString();
_store.AddOrUpdate(key, ticket, (k, t) => ticket);
return Task.FromResult(key);
}
19
Source : CookieMiddlewareTests.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public Task<string> StoreAsync(AuthenticationTicket ticket)
{
var key = Guid.NewGuid().ToString();
_store[key] = ticket;
return Task.FromResult(key);
}
19
Source : ReceiverConfig.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public Task<string> GetReceiverConfigAsync(string name, string id)
{
IDictionary<string, string> secrets;
if (_secrets.TryGetValue(name, out secrets))
{
string secret;
if (secrets.TryGetValue(id, out secret))
{
return Task.FromResult(secret);
}
}
return Task.FromResult<string>(null);
}
19
Source : WebHookReceiverConfig.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public virtual Task<string> GetReceiverConfigAsync(string name, string id)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (id == null)
{
id = string.Empty;
}
var key = GetConfigKey(name, id);
var result = _config.TryGetValue(key, out var value) ? value : null;
return Task.FromResult(result);
}
19
Source : WebHookUser.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public Task<string> GetUserIdAsync(IPrincipal user)
{
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
string id = null;
if (user is ClaimsPrincipal principal)
{
id = GetClaim(principal, _claimsType);
if (id == null)
{
id = GetClaim(principal, ClaimTypes.NameIdentifier);
}
}
// Fall back to name property
if (id == null && user.Idenreplacedy != null)
{
id = user.Idenreplacedy.Name;
}
if (id == null)
{
var message = CustomResources.Manager_NoUser;
throw new InvalidOperationException(message);
}
return Task.FromResult(id);
}
19
Source : AuthorizationTestGrain.cs
with MIT License
from Async-Hub
with MIT License
from Async-Hub
public Task<string> TakeForEmailVerifiedPolicy(string someString)
{
return Task.FromResult(someString);
}
19
Source : AuthorizationTestGrain.cs
with MIT License
from Async-Hub
with MIT License
from Async-Hub
public Task<string> TakeForCombinedRoles(string someString)
{
return Task.FromResult(someString);
}
19
Source : AuthorizationTestGrain.cs
with MIT License
from Async-Hub
with MIT License
from Async-Hub
public Task<string> TakeForFemaleAdminPolicy(string someString)
{
return Task.FromResult(someString);
}
19
Source : AuthorizationTestGrain.cs
with MIT License
from Async-Hub
with MIT License
from Async-Hub
public Task<string> TakeForFemaleManagerPolicy(string someString)
{
return Task.FromResult(someString);
}
See More Examples