Skip to content

Commit 8cecf21

Browse files
AOA Conversion: Set the AccountDomain property (Azure#32196)
- We missed setting a property with a value passed into the constructor. - Updated the solution to VS 2022.
1 parent 9f6a490 commit 8cecf21

File tree

5 files changed

+90
-7
lines changed

5 files changed

+90
-7
lines changed

sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/Azure.MixedReality.ObjectAnchors.Conversion.sln

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
1+
22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30907.101
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32825.248
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.MixedReality.ObjectAnchors.Conversion", "src\Azure.MixedReality.ObjectAnchors.Conversion.csproj", "{F2DECE5E-D006-41CC-A4F2-2ACE91D18E16}"
77
EndProject

sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
## 0.3.0-beta.6 (Unreleased)
44

5+
### Bugs Fixed
6+
7+
- The `AccountDomain` property on the `ObjectAnchorsConversionClient` is not properly set to the value passed into the
8+
constructor.
9+
510
### Features Added
611

7-
- Added DisableDetectScaleUnits to AssetConversionOptions.
8-
- In version 0.3.2+ we will by default detect and use the scale units in FBX files if it is valid, the property DisableDetectScaleUnits controls if users want that behavior or not.
9-
- In version below 0.3.2, the property is ignored so that we are compatible with old SDK versions.
12+
- As of API version `0.3-preview.2`, we have begun detecting and using asset scale units embedded in FBX files for asset
13+
conversion. The detected scale unit will be used by default. To disable this behavior, you can set the new
14+
`DisableDetectScaleUnits` option in `AssetConversionOptions` to `true`. The `DisableDetectScaleUnits` option is
15+
ignored in previous API versions.
1016

1117
## 0.3.0-beta.5 (2022-09-12)
1218

sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/src/ObjectAnchorsConversionClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public ObjectAnchorsConversionClient(Guid accountId, string accountDomain, Token
103103
Uri serviceEndpoint = options.ServiceEndpoint ?? ConstructObjectAnchorsEndpointUrl(accountDomain);
104104

105105
AccountId = accountId;
106+
AccountDomain = accountDomain;
106107
SupportedAssetFileTypesSet = options.SupportedAssetFileTypes;
107108
_clientDiagnostics = new ClientDiagnostics(options);
108109
_pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(mrTokenCredential, GetDefaultScope(serviceEndpoint)));

sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/src/ObjectAnchorsConversionClientOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using System;
5-
using System.Collections;
65
using System.Collections.Generic;
76
using Azure.Core;
87
using Azure.MixedReality.Authentication;

sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/tests/ObjectAnchorsConversionClientTests.cs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using System.Threading.Tasks;
77
using Azure.Core;
88
using Azure.Core.TestFramework;
9+
using Azure.Identity;
10+
using Azure.MixedReality.Authentication;
911
using Moq;
1012
using NUnit.Framework;
1113
using NUnit.Framework.Internal;
@@ -52,6 +54,74 @@ public ObjectAnchorsConversionClientTests(bool isAsync) : base(isAsync)
5254
},
5355
};
5456

57+
[Test]
58+
public void Constructor()
59+
{
60+
// Arrange
61+
Guid accountId = Guid.Parse("00000000-0000-0000-0000-000000000001");
62+
string accountDomain = "my.domain.com";
63+
AccessToken token = new AccessToken("dummykey", new DateTimeOffset(new DateTime(3000, 1, 1)));
64+
AzureKeyCredential keyCredential = new AzureKeyCredential("MyAccessKey");
65+
ObjectAnchorsConversionClientOptions options = new ObjectAnchorsConversionClientOptions();
66+
TokenCredential credential = new StaticAccessTokenCredential(token);
67+
68+
// Act
69+
ObjectAnchorsConversionClient client = new ObjectAnchorsConversionClient(accountId, accountDomain, keyCredential);
70+
71+
// Assert
72+
Assert.AreEqual(accountId, client.AccountId);
73+
Assert.AreEqual(accountDomain, client.AccountDomain);
74+
Assert.NotNull(client.SupportedAssetFileTypes);
75+
76+
// Act and assert
77+
78+
// new(Guid accountId, string accountDomain, AzureKeyCredential keyCredential)
79+
AssertArgumentException<ArgumentException>(nameof(accountId),
80+
() => new ObjectAnchorsConversionClient(default, accountDomain, keyCredential));
81+
AssertArgumentException<ArgumentNullException>(nameof(accountDomain),
82+
() => new ObjectAnchorsConversionClient(accountId, null!, keyCredential));
83+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
84+
() => new ObjectAnchorsConversionClient(accountId, string.Empty, keyCredential));
85+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
86+
() => new ObjectAnchorsConversionClient(accountId, " ", keyCredential));
87+
AssertArgumentException<ArgumentNullException>(nameof(keyCredential),
88+
() => new ObjectAnchorsConversionClient(accountId, accountDomain, null!));
89+
90+
// new(Guid accountId, string accountDomain, AzureKeyCredential keyCredential, ObjectAnchorsConversionClientOptions options)
91+
AssertArgumentException<ArgumentException>(nameof(accountId),
92+
() => new ObjectAnchorsConversionClient(default, accountDomain, keyCredential, options));
93+
AssertArgumentException<ArgumentNullException>(nameof(accountDomain),
94+
() => new ObjectAnchorsConversionClient(accountId, null!, keyCredential, options));
95+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
96+
() => new ObjectAnchorsConversionClient(accountId, string.Empty, keyCredential, options));
97+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
98+
() => new ObjectAnchorsConversionClient(accountId, " ", keyCredential, options));
99+
AssertArgumentException<ArgumentNullException>(nameof(keyCredential),
100+
() => new ObjectAnchorsConversionClient(accountId, accountDomain, (AzureKeyCredential)null!, options));
101+
102+
// new(Guid accountId, string accountDomain, AccessToken token, ObjectAnchorsConversionClientOptions options = null)
103+
AssertArgumentException<ArgumentException>(nameof(accountId),
104+
() => new ObjectAnchorsConversionClient(default, accountDomain, token, options));
105+
AssertArgumentException<ArgumentNullException>(nameof(accountDomain),
106+
() => new ObjectAnchorsConversionClient(accountId, null!, token, options));
107+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
108+
() => new ObjectAnchorsConversionClient(accountId, string.Empty, token, options));
109+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
110+
() => new ObjectAnchorsConversionClient(accountId, " ", token, options));
111+
112+
// new(Guid accountId, string accountDomain, TokenCredential credential, ObjectAnchorsConversionClientOptions options = null)
113+
AssertArgumentException<ArgumentException>(nameof(accountId),
114+
() => new ObjectAnchorsConversionClient(default, accountDomain, credential, options));
115+
AssertArgumentException<ArgumentNullException>(nameof(accountDomain),
116+
() => new ObjectAnchorsConversionClient(accountId, null!, credential, options));
117+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
118+
() => new ObjectAnchorsConversionClient(accountId, string.Empty, credential, options));
119+
AssertArgumentException<ArgumentException>(nameof(accountDomain),
120+
() => new ObjectAnchorsConversionClient(accountId, " ", credential, options));
121+
AssertArgumentException<ArgumentNullException>(nameof(credential),
122+
() => new ObjectAnchorsConversionClient(accountId, accountDomain, (TokenCredential)null!, options));
123+
}
124+
55125
[Test]
56126
[TestCaseSource(nameof(BadClientArgumentsTestData))]
57127
public void BadClientArguments(Guid accountId, string accountDomain, AccessToken credential, bool shouldSucceed)
@@ -90,5 +160,12 @@ public async Task BadFileType(AssetFileType ft, bool passes)
90160

91161
Assert.True(exceptedWithUnsupportedFileType);
92162
}
163+
164+
private static void AssertArgumentException<TException>(string argumentName, TestDelegate code)
165+
where TException : ArgumentException
166+
{
167+
TException exception = Assert.Throws<TException>(code);
168+
Assert.AreEqual(argumentName, exception.ParamName);
169+
}
93170
}
94171
}

0 commit comments

Comments
 (0)