Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion authentication/test/Autodesk.Authentication.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -13,6 +12,8 @@
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\source\Autodesk.Authentication.csproj"/>
</ItemGroup>

Expand Down
19 changes: 11 additions & 8 deletions authentication/test/TestAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ public class TestAuthentication
string client_id = "<client_id>";
string client_secret = "<client_secret>";

string authorization_code = "code";
string redirect_uri = @"redirect_uri";
string authorization_code = "<authorization_code>";
string redirect_uri = @"<redirect_uri>";

string token = "<token>";
string threeLeggedTokenAccesstoken = "<three_legged_token_accesstoken>";
string refreshToken = "<refresh_token>";

[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
Expand Down Expand Up @@ -56,7 +60,6 @@ public async Task Test3LeggedTokenAsync()
Assert.IsNotNull(threeLeggedToken_accesstoken);
}


[TestMethod]
public async Task TestRefreshTokenAsync()
{
Expand All @@ -82,23 +85,23 @@ public async Task TestOidcSpecAsync()
[TestMethod]
public async Task TestUserInfoAsync()
{
UserInfo userInfo = await _authClient.GetUserInfoAsync("threeLeggedToken_accesstoken");
UserInfo userInfo = await _authClient.GetUserInfoAsync(threeLeggedTokenAccesstoken);
Assert.IsNotNull(userInfo);
}

[TestMethod]

public async Task TestIntrospectTokenAsync()
{
IntrospectToken introspectToken = await _authClient.IntrospectTokenAsync("token", client_id, client_secret);
var exp = introspectToken.Exp;
Assert.IsNotNull(exp);
IntrospectToken introspectToken = await _authClient.IntrospectTokenAsync(token, client_id, client_secret);
var exp = introspectToken.Exp;
Assert.IsNotNull(exp);
}

[TestMethod]
public async Task TestRevokeTokenAsync()
{
HttpResponseMessage response = await _authClient.RevokeAsync("token", client_id,client_secret);
HttpResponseMessage response = await _authClient.RevokeAsync(token, client_id, client_secret);
Assert.IsTrue(response.IsSuccessStatusCode);
}

Expand Down
73 changes: 37 additions & 36 deletions modelderivative/test/TestModelDerivativeApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,47 @@ public static void ClassInitialize(TestContext testContext)
public async Task TestFormatsAsync()
{

Formats formats = await _mdClient.GetFormatsAsync(accessToken: token);
Assert.IsTrue(formats.SupportedFormats.Count() == 10);
SupportedFormats supportedFormats = await _mdClient.GetFormatsAsync(accessToken: token);
Assert.IsInstanceOfType(supportedFormats.Formats, typeof(Dictionary<string, List<string>>));
}

[TestMethod]
public async Task TestJobAsync()
{
// set output formats
List<JobPayloadFormat> outputFormats = new List<JobPayloadFormat>()
{
// initialising an Svf2 output class will automatically set the type to Svf2.
// No need to call Type = TypeEnum.Svf2
new JobSvf2OutputFormat()
{

Views = new List<View>()
{
View._2d,
View._3d
},

},
List<IJobPayloadFormat> outputFormats = new List<IJobPayloadFormat>()
{
// initialising an Svf2 output class will automatically set the type to Svf2.
// No need to call Type = TypeEnum.Svf2
new JobPayloadFormatSVF2()
{

// initialising a Thumbnail output class will automatically set the type to Thumbnail.
// No need to call Type = TypeEnum.Thumbnail
new JobThumbnailOutputFormat()
{
Advanced = new JobThumbnailOutputFormatAdvanced(){
Views = new List<View>()
{
View._2d,
View._3d
},
Advanced = new JobPayloadFormatSVF2AdvancedRVT()
{
GenerateMasterViews = true
}

},

// initialising a Thumbnail output class will automatically set the type to Thumbnail.
// No need to call Type = TypeEnum.Thumbnail
new JobPayloadFormatThumbnail()
{
Advanced = new JobPayloadFormatAdvancedThumbnail(){

Width = Width.NUMBER_100,
Height = Height.NUMBER_100
}
Width = Width.NUMBER_100,
Height = Height.NUMBER_100
}


}
}

};
};


// specify Job details
Expand All @@ -79,46 +83,43 @@ public async Task TestJobAsync()
{
Urn = urn,
CompressedUrn = false,
RootFilename = "<filename>",



},
Output = new JobPayloadOutput()
{
Formats = outputFormats,
Destination = Region.US
},



};

// start the translation job
Job jobResponse = await _mdClient.StartJobAsync(jobPayload: Job, accessToken: token);
Job jobResponse = await _mdClient.StartJobAsync(jobPayload: Job, accessToken: token, region: Region.US);
Assert.IsTrue(jobResponse.Result == "created");
}

[TestMethod]
public async Task TestGetManifestAsync()
{
Manifest manifestResponse = await _mdClient.GetManifestAsync(urn, accessToken: token);
// token
Manifest manifestResponse = await _mdClient.GetManifestAsync(accessToken: token, urn);
string progress = manifestResponse.Progress;
Assert.IsTrue(progress == "complete");
}

[TestMethod]
public async Task TestGetMetadataAsync()
{
ModelViews modelViewsResponse = await _mdClient.GetModelViewsAsync(urn, accessToken: token);
// token
ModelViews modelViewsResponse = await _mdClient.GetModelViewsAsync(accessToken: token, urn);
Assert.IsTrue(modelViewsResponse.Data.Metadata.Count > 0);
}

[TestMethod]
public async Task GetThumbnailAsync()
{

Stream thumbnail = await _mdClient.GetThumbnailAsync(urn, Width.NUMBER_100, Height.NUMBER_100, accessToken: token);
// token
Stream thumbnail = await _mdClient.GetThumbnailAsync(accessToken: token, urn, Width.NUMBER_100, Height.NUMBER_100, Region.US);
Assert.AreNotSame(thumbnail, null);

}
Expand Down
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Local" value="./samples/packages/" />
<add key="Local" value="./samples/packages" />
</packageSources>
</configuration>