Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Microsoft.Logic API Version: 2018-07-01-preview #4770

Merged
merged 5 commits into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/SDKs/Logic/AzSdk.RP.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
<PropertyGroup>
<AzureApiTag />
<AzureApiTag>Logic_2018-07-01-preview;</AzureApiTag>
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
</PropertyGroup>
</Project>
15 changes: 1 addition & 14 deletions src/SDKs/Logic/Logic.Tests/InMemoryTests/InMemoryTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ namespace Test.Azure.Management.Logic
/// </summary>
abstract public class InMemoryTestsBase
{
/// <summary>
/// Test resourcegroup name for integration account
/// </summary>
protected static string ResourceGroupName = Constants.DefaultResourceGroup;

/// <summary>
/// Empty content string
/// </summary>
protected StringContent Empty = new StringContent(string.Empty);

/// <summary>
/// Creates a mock LogicManagementClient
/// </summary>
Expand Down Expand Up @@ -64,10 +54,7 @@ protected bool ValidateIdFormat(string id, string entityTypeName, string entityS

pattern += @"/[0-9a-z\-]*$";

return Regex.IsMatch(
input: id,
pattern: pattern,
options: RegexOptions.IgnoreCase);
return Regex.IsMatch(input: id, pattern: pattern, options: RegexOptions.IgnoreCase);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,22 @@ namespace Test.Azure.Management.Logic

public class IntegrationAccountInMemoryTests : InMemoryTestsBase
{
private StringContent IntegrationAccountsList { get; set; }

private StringContent IntegrationAccount { get; set; }

private StringContent IntegrationAccountCallbackUrl { get; set; }

public IntegrationAccountInMemoryTests()
{
var content = File.ReadAllText(@"TestData/IntegrationAccountResponseContent.json");
var callbackUrlContent = File.ReadAllText(@"TestData/IntegrationAccountCallbackUrlResponseContent.json");

this.IntegrationAccountsList =
new StringContent(string.Format(Constants.ListFormat,
content, Constants.NextPageLink));
this.IntegrationAccountsList = new StringContent(string.Format(Constants.ListFormat, content, Constants.NextPageLink));
this.IntegrationAccount = new StringContent(content);
this.IntegrationAccountCallbackUrl = new StringContent(callbackUrlContent);
}

private StringContent IntegrationAccountsList { get; set; }

private StringContent IntegrationAccount { get; set; }

private StringContent IntegrationAccountCallbackUrl { get; set; }

[Fact]
public void IntegrationAccounts_ListBySubscription_Success()
{
Expand Down Expand Up @@ -123,7 +121,7 @@ public void IntegrationAccounts_ListByResourceGroup_Exception()
};

Assert.Throws<ValidationException>(() => client.IntegrationAccounts.ListByResourceGroup(null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.ListByResourceGroup(ResourceGroupName));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.ListByResourceGroup(Constants.DefaultResourceGroup));
}

[Fact]
Expand All @@ -138,7 +136,7 @@ public void IntegrationAccounts_ListByResourceGroup_Success()
Content = this.IntegrationAccountsList
};

var result = client.IntegrationAccounts.ListByResourceGroup(ResourceGroupName);
var result = client.IntegrationAccounts.ListByResourceGroup(Constants.DefaultResourceGroup);

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand Down Expand Up @@ -199,9 +197,9 @@ public void IntegrationAccounts_CreateOrUpdate_Exception()
};

Assert.Throws<ValidationException>(() => client.IntegrationAccounts.CreateOrUpdate(null, "IntegrationAccountName", new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.CreateOrUpdate(ResourceGroupName, null, new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.CreateOrUpdate(ResourceGroupName, "IntegrationAccountName", null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.CreateOrUpdate(ResourceGroupName, "IntegrationAccountName", new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.CreateOrUpdate(Constants.DefaultResourceGroup, null, new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.CreateOrUpdate(Constants.DefaultResourceGroup, "IntegrationAccountName", null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.CreateOrUpdate(Constants.DefaultResourceGroup, "IntegrationAccountName", new IntegrationAccount()));
}

[Fact]
Expand All @@ -216,7 +214,7 @@ public void IntegrationAccounts_CreateOrUpdate_OK()
Content = this.IntegrationAccount
};

var integrationAccount = client.IntegrationAccounts.CreateOrUpdate(ResourceGroupName, "IntegrationAccountName", new IntegrationAccount());
var integrationAccount = client.IntegrationAccounts.CreateOrUpdate(Constants.DefaultResourceGroup, "IntegrationAccountName", new IntegrationAccount());

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand All @@ -238,7 +236,7 @@ public void IntegrationAccounts_CreateOrUpdate_Created()
Content = this.IntegrationAccount
};

var integrationAccount = client.IntegrationAccounts.CreateOrUpdate(ResourceGroupName, "IntegrationAccountName", new IntegrationAccount());
var integrationAccount = client.IntegrationAccounts.CreateOrUpdate(Constants.DefaultResourceGroup, "IntegrationAccountName", new IntegrationAccount());

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand All @@ -256,12 +254,13 @@ public void IntegrationAccounts_Delete_Exception()

handler.Response = new HttpResponseMessage
{
StatusCode = HttpStatusCode.NotFound
StatusCode = HttpStatusCode.NotFound,
Content = new StringContent(string.Empty)
};

Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Delete(null, "IntegrationAccountName"));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Delete(ResourceGroupName, null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.Delete(ResourceGroupName, "IntegrationAccountName"));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Delete(Constants.DefaultResourceGroup, null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.Delete(Constants.DefaultResourceGroup, "IntegrationAccountName"));
}

[Fact]
Expand All @@ -275,7 +274,7 @@ public void IntegrationAccounts_Delete_OK()
StatusCode = HttpStatusCode.OK
};

client.IntegrationAccounts.Delete(ResourceGroupName, "IntegrationAccountName");
client.IntegrationAccounts.Delete(Constants.DefaultResourceGroup, "IntegrationAccountName");

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand All @@ -293,7 +292,7 @@ public void IntegrationAccounts_Delete_NoContent()
StatusCode = HttpStatusCode.NoContent
};

client.IntegrationAccounts.Delete(ResourceGroupName, "IntegrationAccountName");
client.IntegrationAccounts.Delete(Constants.DefaultResourceGroup, "IntegrationAccountName");

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand All @@ -313,8 +312,8 @@ public void IntegrationAccounts_Get_Exception()
};

Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Get(null, "IntegrationAccountName"));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Get(ResourceGroupName, null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.Get(ResourceGroupName, "IntegrationAccountName"));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Get(Constants.DefaultResourceGroup, null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.Get(Constants.DefaultResourceGroup, "IntegrationAccountName"));
}

[Fact]
Expand All @@ -329,7 +328,7 @@ public void IntegrationAccounts_Get_OK()
Content = this.IntegrationAccount
};

var result = client.IntegrationAccounts.Get(ResourceGroupName, "IntegrationAccountName");
var result = client.IntegrationAccounts.Get(Constants.DefaultResourceGroup, "IntegrationAccountName");

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand All @@ -352,9 +351,9 @@ public void IntegrationAccounts_Update_Exception()
};

Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Update(null, "IntegrationAccountName", new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Update(ResourceGroupName, null, new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Update(ResourceGroupName, "IntegrationAccountName", null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.Update(ResourceGroupName, "IntegrationAccountName", new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Update(Constants.DefaultResourceGroup, null, new IntegrationAccount()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.Update(Constants.DefaultResourceGroup, "IntegrationAccountName", null));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.Update(Constants.DefaultResourceGroup, "IntegrationAccountName", new IntegrationAccount()));
}

[Fact]
Expand All @@ -374,7 +373,7 @@ public void IntegrationAccounts_Update_OK()
Tags = new Dictionary<string, string>()
};

integrationAccount = client.IntegrationAccounts.Update(ResourceGroupName, "IntegrationAccountName", integrationAccount);
integrationAccount = client.IntegrationAccounts.Update(Constants.DefaultResourceGroup, "IntegrationAccountName", integrationAccount);

// Validates request.
handler.Request.ValidateAuthorizationHeader();
Expand All @@ -397,9 +396,9 @@ public void IntegrationAccounts_ListCallbackUrl_Exception()
Content = new StringContent(string.Empty)
};

Assert.Throws<ValidationException>(() => client.IntegrationAccounts.GetCallbackUrl(null, "IntegrationAccountName", new GetCallbackUrlParameters()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.GetCallbackUrl(ResourceGroupName, null, new GetCallbackUrlParameters()));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.GetCallbackUrl(ResourceGroupName, "IntegrationAccountName", new GetCallbackUrlParameters()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.ListCallbackUrl(null, "IntegrationAccountName", new GetCallbackUrlParameters()));
Assert.Throws<ValidationException>(() => client.IntegrationAccounts.ListCallbackUrl(Constants.DefaultResourceGroup, null, new GetCallbackUrlParameters()));
Assert.Throws<CloudException>(() => client.IntegrationAccounts.ListCallbackUrl(Constants.DefaultResourceGroup, "IntegrationAccountName", new GetCallbackUrlParameters()));
}

[Fact]
Expand All @@ -414,20 +413,19 @@ public void IntegrationAccounts_ListCallbackUrl_OK()
Content = this.IntegrationAccountCallbackUrl
};

var result = client.IntegrationAccounts.GetCallbackUrl(ResourceGroupName, "IntegrationAccountName", new GetCallbackUrlParameters());
var result = client.IntegrationAccounts.ListCallbackUrl(Constants.DefaultResourceGroup, "IntegrationAccountName", new GetCallbackUrlParameters());

// Validates request.
handler.Request.ValidateAuthorizationHeader();
handler.Request.ValidateMethod(HttpMethod.Post);

Assert.NotNull(result.Value);
// Validates result.

Assert.NotNull(result.Value);
}

private void ValidateIntegrationAccountList(IPage<IntegrationAccount> result)
{
Assert.Equal(1, result.Count());
Assert.Single(result);
this.ValidateIntegrationAccount(result.First());
Assert.Equal(Constants.NextPageLink, result.NextPageLink);
}
Expand Down
Loading