Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@
<Compile Remove="IntegrationTest\Contentstack004_ReleaseTest.cs" />
<Compile Remove="IntegrationTest\Contentstack012b_ContentTypeExpandedIntegrationTest.cs" />

<Compile Remove="IntegrationTest\Contentstack016_DeliveryTokenTest.cs" />
<Compile Remove="IntegrationTest\Contentstack017_TaxonomyTest.cs" />
<Compile Remove="IntegrationTest\Contentstack019_RoleTest.cs" />
<Compile Remove="IntegrationTest\Contentstack020_WorkflowTest.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ public void Test005_Should_Update_Workflow_Properties()
AssertLogger.IsTrue(response.IsSuccessStatusCode, $"Workflow update failed with status {(int)response.StatusCode}", "workflowUpdateSuccess");
AssertLogger.IsNotNull(responseJson["workflow"], "workflowObject");
AssertLogger.AreEqual(updatedName, responseJson["workflow"]["name"]?.ToString(), "updatedWorkflowName");
AssertLogger.AreEqual(false, responseJson["workflow"]["enabled"]?.Value<bool>(), "updatedEnabledStatus");
AssertLogger.AreEqual(false, responseJson["workflow"]["enabled"]?.GetValue<bool>(), "updatedEnabledStatus");

TestOutputLogger.LogContext("UpdatedWorkflowUid", workflowUid);
}
Expand Down Expand Up @@ -1600,7 +1600,7 @@ public async Task Test012_Should_Update_Publish_Rule()
// Assert
AssertLogger.IsNotNull(response, "publishRuleUpdateResponse");
AssertLogger.IsTrue(response.IsSuccessStatusCode, $"Publish rule update failed with status {(int)response.StatusCode}", "publishRuleUpdateSuccess");
AssertLogger.AreEqual(true, responseJson["publishing_rule"]["disable_approver_publishing"]?.Value<bool>(), "updatedDisableApproval");
AssertLogger.AreEqual(true, responseJson["publishing_rule"]["disable_approver_publishing"]?.GetValue<bool>(), "updatedDisableApproval");

TestOutputLogger.LogContext("UpdatedPublishRuleUid", publishRuleUid);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,13 @@
<!-- Out-of-scope model tests (not in the 12-module migration) -->
<Compile Remove="Models\AuditLogTest.cs" />
<Compile Remove="Models\BaseModelTest.cs" />
<Compile Remove="Models\DeliveryTokenTest.cs" />
<Compile Remove="Models\ExtensionTest.cs" />
<Compile Remove="Models\ExtensionModelTest.cs" />
<Compile Remove="Models\LabelTest.cs" />
<Compile Remove="Models\PublishQueueTest.cs" />
<Compile Remove="Models\PublishRuleTest.cs" />
<Compile Remove="Models\ReleaseTest.cs" />
<Compile Remove="Models\ReleaseItemTest.cs" />
<Compile Remove="Models\RoleTest.cs" />
<Compile Remove="Models\TaxonomyTest.cs" />
<Compile Remove="Models\TermTest.cs" />
<Compile Remove="Models\WebhookTest.cs" />
<Compile Remove="Models\WorkflowTest.cs" />
<Compile Remove="Models\CustomExtensionTest.cs" />

<!-- OAuth tests (out of scope) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public void Initialize_DeliveryToken()
DeliveryToken token = new DeliveryToken(_stack);
Assert.IsNull(token.Uid);
Assert.AreEqual("stacks/delivery_tokens", token.resourcePath);
Assert.ThrowsException<InvalidOperationException>(() => token.Fetch());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => token.FetchAsync());
Assert.ThrowsException<InvalidOperationException>(() => token.Update(_fixture.Create<DeliveryTokenModel>()));
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => token.UpdateAsync(_fixture.Create<DeliveryTokenModel>()));
Assert.ThrowsException<InvalidOperationException>(() => token.Delete());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => token.DeleteAsync());
Assert.ThrowsException<ArgumentException>(() => token.Fetch());
Assert.ThrowsExceptionAsync<ArgumentException>(() => token.FetchAsync());
Assert.ThrowsException<ArgumentException>(() => token.Update(_fixture.Create<DeliveryTokenModel>()));
Assert.ThrowsExceptionAsync<ArgumentException>(() => token.UpdateAsync(_fixture.Create<DeliveryTokenModel>()));
Assert.ThrowsException<ArgumentException>(() => token.Delete());
Assert.ThrowsExceptionAsync<ArgumentException>(() => token.DeleteAsync());
Assert.AreEqual(token.Query().GetType(), typeof(Query));
}

Expand Down
32 changes: 16 additions & 16 deletions Contentstack.Management.Core.Unit.Tests/Models/PublishRuleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public void Initialize_PublishRule()

Assert.IsNull(publishRule.Uid);
Assert.AreEqual($"/workflows/publishing_rules", publishRule.resourcePath);
Assert.ThrowsException<InvalidOperationException>(() => publishRule.Fetch());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => publishRule.FetchAsync());
Assert.ThrowsException<InvalidOperationException>(() => publishRule.Update(_fixture.Create<PublishRuleModel>()));
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => publishRule.UpdateAsync(_fixture.Create<PublishRuleModel>()));
Assert.ThrowsException<InvalidOperationException>(() => publishRule.Delete());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => publishRule.DeleteAsync());
Assert.ThrowsException<ArgumentException>(() => publishRule.Fetch());
Assert.ThrowsExceptionAsync<ArgumentException>(() => publishRule.FetchAsync());
Assert.ThrowsException<ArgumentException>(() => publishRule.Update(_fixture.Create<PublishRuleModel>()));
Assert.ThrowsExceptionAsync<ArgumentException>(() => publishRule.UpdateAsync(_fixture.Create<PublishRuleModel>()));
Assert.ThrowsException<ArgumentException>(() => publishRule.Delete());
Assert.ThrowsExceptionAsync<ArgumentException>(() => publishRule.DeleteAsync());
}

[TestMethod]
Expand All @@ -57,7 +57,7 @@ public void Should_Create_PublishRule()
ContentstackResponse response = _stack.Workflow().PublishRule().Create(new PublishRuleModel());

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -66,7 +66,7 @@ public async System.Threading.Tasks.Task Should_Create_PublishRule_Async()
ContentstackResponse response = await _stack.Workflow().PublishRule().CreateAsync(new PublishRuleModel());

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -75,7 +75,7 @@ public void Should_Find_All_PublishRule()
ContentstackResponse response = _stack.Workflow().PublishRule().FindAll();

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -84,7 +84,7 @@ public async System.Threading.Tasks.Task Should_Find_All_PublishRule_Async()
ContentstackResponse response = await _stack.Workflow().PublishRule().FindAllAsync();

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -93,7 +93,7 @@ public void Should_Fetch_PublishRule()
ContentstackResponse response = _stack.Workflow().PublishRule(_fixture.Create<string>()).Fetch();

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -102,7 +102,7 @@ public async System.Threading.Tasks.Task Should_Find_PublishRule_Async()
ContentstackResponse response = await _stack.Workflow().PublishRule(_fixture.Create<string>()).FetchAsync();

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -111,7 +111,7 @@ public void Should_Update_PublishRule()
ContentstackResponse response = _stack.Workflow().PublishRule(_fixture.Create<string>()).Update(new PublishRuleModel());

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -120,7 +120,7 @@ public async System.Threading.Tasks.Task Should_Update_PublishRule_Async()
ContentstackResponse response = await _stack.Workflow().PublishRule(_fixture.Create<string>()).UpdateAsync(new PublishRuleModel());

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -129,7 +129,7 @@ public void Should_Delete_PublishRule()
ContentstackResponse response = _stack.Workflow().PublishRule(_fixture.Create<string>()).Delete();

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}

[TestMethod]
Expand All @@ -138,7 +138,7 @@ public async System.Threading.Tasks.Task Should_Delete_PublishRule_Async()
ContentstackResponse response = await _stack.Workflow().PublishRule(_fixture.Create<string>()).DeleteAsync();

Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString());
}
}
}
26 changes: 13 additions & 13 deletions Contentstack.Management.Core.Unit.Tests/Models/TaxonomyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public void Initialize_Taxonomy()

Assert.IsNull(taxonomy.Uid);
Assert.AreEqual("/taxonomies", taxonomy.resourcePath);
Assert.ThrowsException<InvalidOperationException>(() => taxonomy.Fetch());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => taxonomy.FetchAsync());
Assert.ThrowsException<InvalidOperationException>(() => taxonomy.Update(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => taxonomy.UpdateAsync(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsException<InvalidOperationException>(() => taxonomy.Delete());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => taxonomy.DeleteAsync());
Assert.ThrowsException<InvalidOperationException>(() => taxonomy.Terms());
Assert.ThrowsException<ArgumentException>(() => taxonomy.Fetch());
Assert.ThrowsExceptionAsync<ArgumentException>(() => taxonomy.FetchAsync());
Assert.ThrowsException<ArgumentException>(() => taxonomy.Update(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsExceptionAsync<ArgumentException>(() => taxonomy.UpdateAsync(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsException<ArgumentException>(() => taxonomy.Delete());
Assert.ThrowsExceptionAsync<ArgumentException>(() => taxonomy.DeleteAsync());
Assert.ThrowsException<ArgumentException>(() => taxonomy.Terms());
Assert.AreEqual(typeof(Query), taxonomy.Query().GetType());
}

Expand Down Expand Up @@ -136,22 +136,22 @@ public void Should_Get_Single_Term_From_Taxonomy()
[TestMethod]
public void Export_Throws_When_Uid_Is_Empty()
{
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy().Export());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy().ExportAsync());
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy().Export());
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy().ExportAsync());
}

[TestMethod]
public void Locales_Throws_When_Uid_Is_Empty()
{
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy().Locales());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy().LocalesAsync());
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy().Locales());
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy().LocalesAsync());
}

[TestMethod]
public void Localize_Throws_When_Uid_Is_Empty()
{
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy().Localize(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy().LocalizeAsync(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy().Localize(_fixture.Create<TaxonomyModel>()));
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy().LocalizeAsync(_fixture.Create<TaxonomyModel>()));
}

[TestMethod]
Expand Down
24 changes: 12 additions & 12 deletions Contentstack.Management.Core.Unit.Tests/Models/TermTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public void Initialize_Term_Collection()

Assert.IsNull(term.Uid);
Assert.AreEqual($"/taxonomies/{taxonomyUid}/terms", term.resourcePath);
Assert.ThrowsException<InvalidOperationException>(() => term.Fetch());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => term.FetchAsync());
Assert.ThrowsException<ArgumentException>(() => term.Fetch());
Assert.ThrowsExceptionAsync<ArgumentException>(() => term.FetchAsync());
Assert.AreEqual(typeof(Query), term.Query().GetType());
}

Expand Down Expand Up @@ -139,40 +139,40 @@ public async System.Threading.Tasks.Task Should_Search_Terms_Async()
public void Ancestors_Throws_When_Term_Uid_Is_Empty()
{
string taxonomyUid = _fixture.Create<string>();
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().Ancestors());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().AncestorsAsync());
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().Ancestors());
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().AncestorsAsync());
}

[TestMethod]
public void Descendants_Throws_When_Term_Uid_Is_Empty()
{
string taxonomyUid = _fixture.Create<string>();
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().Descendants());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().DescendantsAsync());
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().Descendants());
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().DescendantsAsync());
}

[TestMethod]
public void Move_Throws_When_Term_Uid_Is_Empty()
{
string taxonomyUid = _fixture.Create<string>();
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().Move(_fixture.Create<TermMoveModel>()));
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().MoveAsync(_fixture.Create<TermMoveModel>()));
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().Move(_fixture.Create<TermMoveModel>()));
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().MoveAsync(_fixture.Create<TermMoveModel>()));
}

[TestMethod]
public void Locales_Throws_When_Term_Uid_Is_Empty()
{
string taxonomyUid = _fixture.Create<string>();
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().Locales());
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().LocalesAsync());
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().Locales());
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().LocalesAsync());
}

[TestMethod]
public void Localize_Throws_When_Term_Uid_Is_Empty()
{
string taxonomyUid = _fixture.Create<string>();
Assert.ThrowsException<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().Localize(_fixture.Create<TermModel>()));
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => _stack.Taxonomy(taxonomyUid).Terms().LocalizeAsync(_fixture.Create<TermModel>()));
Assert.ThrowsException<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().Localize(_fixture.Create<TermModel>()));
Assert.ThrowsExceptionAsync<ArgumentException>(() => _stack.Taxonomy(taxonomyUid).Terms().LocalizeAsync(_fixture.Create<TermModel>()));
}
}
}
Loading
Loading