public void IsOriginAnAllowedSubdomain_ReturnsFalse_WhenNotASubdomain(string origin, string allowedOrigin) { // Arrange var policy = new CorsPolicy(); policy.Origins.Add(allowedOrigin); // Act var isAllowed = policy.IsOriginAnAllowedSubdomain(origin); // Assert Assert.False(isAllowed); }
public void IsOriginAnAllowedSubdomain_ReturnsFalseIfOriginIsMalformedUri(string malformedOrigin) { // Arrange var policy = new CorsPolicy(); policy.Origins.Add("http://*.domain"); // Act var actual = policy.IsOriginAnAllowedSubdomain(malformedOrigin); // Assert Assert.False(actual); }
public void IsOriginAnAllowedSubdomain_ReturnsTrueIfPolicyContainsOrigin() { // Arrange const string origin = "http://sub.domain"; var policy = new CorsPolicy(); policy.Origins.Add(origin); // Act var actual = policy.IsOriginAnAllowedSubdomain(origin); // Assert Assert.True(actual); }