-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNestedInvocationTests.cs
More file actions
45 lines (38 loc) · 1.09 KB
/
NestedInvocationTests.cs
File metadata and controls
45 lines (38 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FixedCode = @"
using System;
class TimeProvider
{
public DateTime GetLocalNow() => DateTime.Now;
}
class S3Provider
{
public string GetGetPresignedUrl(string bucketName, string objectKey, DateTime expires) => $""{bucketName}/{objectKey}/{expires}"";
}
class AppConfiguration
{
public class AmazonConfig
{
public class S3Config
{
public string BucketName { get; set; } = ""my-bucket"";
}
public S3Config S3 { get; set; } = new S3Config();
}
public AmazonConfig Amazon { get; set; } = new AmazonConfig();
}
class Program
{
public Uri GetGetPresignedUrl(string objectKey)
{
var s3Provider = new S3Provider();
var appConfiguration = new AppConfiguration();
var timeProvider = new TimeProvider();
return new Uri(
uriString: s3Provider.GetGetPresignedUrl(
bucketName: appConfiguration.Amazon.S3.BucketName,
objectKey: objectKey,
expires: timeProvider.GetLocalNow().AddHours(value: 24)
)
);
}
}",