diff --git a/Kontent.Ai.Management.Tests/ManagementClientTests/SpaceTests.cs b/Kontent.Ai.Management.Tests/ManagementClientTests/SpaceTests.cs index 05824511..536961ee 100644 --- a/Kontent.Ai.Management.Tests/ManagementClientTests/SpaceTests.cs +++ b/Kontent.Ai.Management.Tests/ManagementClientTests/SpaceTests.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using Kontent.Ai.Management.Models.Shared; using Kontent.Ai.Management.Models.Spaces; using Kontent.Ai.Management.Models.Spaces.Patch; @@ -35,6 +36,14 @@ public async void CreateSpace_CreatesSpace() .Validate(); } + [Fact] + public async void CreateSpace_ModelIsNull_Throws() + { + var client = _scenario.CreateManagementClient(); + + await client.Invoking(x => x.CreateSpaceAsync(null)).Should().ThrowAsync(); + } + [Fact] public async void ListSpaces_ListsSpaces() { @@ -79,6 +88,14 @@ public async void GetSpace_ByCodename_GetsSpace() .Validate(); } + [Fact] + public async void GetSpace_IdentifierIsNull_Throws() + { + var client = _scenario.CreateManagementClient(); + + await client.Invoking(x => x.GetSpaceAsync(null)).Should().ThrowAsync(); + } + [Fact] public async void ModifySpace_Replace_ModifiesSpace() { @@ -101,6 +118,27 @@ public async void ModifySpace_Replace_ModifiesSpace() .Validate(); } + [Fact] + public async void ModifySpace_IdentifierIsNull_Throws() + { + var client = _scenario.CreateManagementClient(); + var changes = new SpaceOperationReplaceModel[] + { + new() { PropertyName = PropertyName.Name, Value = "New space name" } + }; + + await client.Invoking(x => x.ModifySpaceAsync(null, changes)).Should().ThrowAsync(); + } + + [Fact] + public async void ModifySpace_ChangesAreNull_Throws() + { + var client = _scenario.CreateManagementClient(); + var identifier = Reference.ById(Guid.NewGuid()); + + await client.Invoking(x => x.ModifySpaceAsync(identifier, null)).Should().ThrowAsync(); + } + [Fact] public async void DeleteSpace_ById_DeletesSpace() { @@ -129,5 +167,13 @@ public async void DeleteSpace_ByCodename_DeletesSpace() .HttpMethod(HttpMethod.Delete) .Validate(); } + + [Fact] + public async void DeleteSpace_IdentifierIsNull_Throws() + { + var client = _scenario.CreateManagementClient(); + + await client.Invoking(x => x.DeleteSpaceAsync(null)).Should().ThrowAsync(); + } } \ No newline at end of file