public void GetCanonicalHeaders_should_return_expected_result() { var timestamp = new DateTime(2020, 03, 12, 14, 23, 46).ToString("yyyyMMddTHHmmssZ"); var requestHeaders = new SortedDictionary <string, string> { ["X-MongoDB-GS2-CB-Flag"] = "n", ["Content-Type"] = "application/x-www-form-urlencoded", ["X-Amz-Date"] = timestamp, ["Content-Length"] = "42", ["Host"] = "iam.testhost.com", ["X-MongoDB-Server-Nonce"] = "123", ["X-Amz-Security-Token"] = "321" }; var expected = "content-length:42\n" + "content-type:application/x-www-form-urlencoded\n" + "host:iam.testhost.com\n" + "x-amz-date:20200312T142346Z\n" + "x-amz-security-token:321\n" + "x-mongodb-gs2-cb-flag:n\n" + "x-mongodb-server-nonce:123"; var actual = AwsSignatureVersion4Reflector.GetCanonicalHeaders(requestHeaders); actual.Should().Be(expected); }
public void GetRegion_should_return_expected_result(string host, string expectedRegion) { var region = AwsSignatureVersion4Reflector.GetRegion(host); region.Should().Be(expectedRegion); }