-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make builders internal (#388)
* Make request builders internal * Make builder for DeleteThemeRequest * Make GetRoomsByThemeRequestBuilder internal * Make UpdateRoomRequestBuilder internal * Make UpdateThemeRequestBuilder internal * Extract parameter from Build for UpdateThemeRequest * Remove Common folders * Remove Common folders * Make AddStreamRequestBuilder internal * Add internal ChangeLayoutRequestBuilder * Make CreateArchiveRequestBuilder internal * Make builder available from Request
- Loading branch information
Showing
97 changed files
with
1,064 additions
and
517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Vonage.Server.Test/Video/Archives/ChangeLayout/RequestBuilderTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System; | ||
using AutoFixture; | ||
using FluentAssertions; | ||
using Vonage.Common.Failures; | ||
using Vonage.Common.Test.Extensions; | ||
using Vonage.Server.Video.Archives.ChangeLayout; | ||
using Xunit; | ||
|
||
namespace Vonage.Server.Test.Video.Archives.ChangeLayout | ||
{ | ||
public class RequestBuilderTest | ||
{ | ||
private readonly Guid applicationId; | ||
private readonly Guid archiveId; | ||
private readonly Layout layout; | ||
|
||
public RequestBuilderTest() | ||
{ | ||
var fixture = new Fixture(); | ||
fixture.Customize(new SupportMutableValueTypesCustomization()); | ||
this.applicationId = fixture.Create<Guid>(); | ||
this.archiveId = fixture.Create<Guid>(); | ||
this.layout = fixture.Create<Layout>(); | ||
} | ||
|
||
[Fact] | ||
public void Parse_ShouldReturnFailure_GivenApplicationIdIsEmpty() => | ||
ChangeLayoutRequest.Build() | ||
.WithApplicationId(Guid.Empty) | ||
.WithArchiveId(this.archiveId) | ||
.WithLayout(this.layout) | ||
.Create() | ||
.Should() | ||
.BeFailure(ResultFailure.FromErrorMessage("ApplicationId cannot be empty.")); | ||
|
||
[Fact] | ||
public void Parse_ShouldReturnFailure_GivenArchiveIdIsEmpty() => | ||
ChangeLayoutRequest.Build() | ||
.WithApplicationId(this.applicationId) | ||
.WithArchiveId(Guid.Empty) | ||
.WithLayout(this.layout) | ||
.Create() | ||
.Should() | ||
.BeFailure(ResultFailure.FromErrorMessage("ArchiveId cannot be empty.")); | ||
|
||
[Fact] | ||
public void Parse_ShouldReturnSuccess_GivenAllValuesAreProvided() => | ||
ChangeLayoutRequest.Build() | ||
.WithApplicationId(this.applicationId) | ||
.WithArchiveId(this.archiveId) | ||
.WithLayout(this.layout) | ||
.Create() | ||
.Should() | ||
.BeSuccess(request => | ||
{ | ||
request.ApplicationId.Should().Be(this.applicationId); | ||
request.ArchiveId.Should().Be(this.archiveId); | ||
request.Layout.Should().Be(this.layout); | ||
}); | ||
} | ||
} |
42 changes: 10 additions & 32 deletions
42
Vonage.Server.Test/Video/Archives/ChangeLayout/RequestTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,35 @@ | ||
using System; | ||
using AutoFixture; | ||
using FluentAssertions; | ||
using Vonage.Common.Failures; | ||
using Vonage.Common.Test.Extensions; | ||
using Vonage.Server.Common; | ||
using Vonage.Server.Video.Archives.ChangeLayout; | ||
using Xunit; | ||
|
||
namespace Vonage.Server.Test.Video.Archives.ChangeLayout | ||
{ | ||
public class RequestTest | ||
{ | ||
private readonly Fixture fixture; | ||
private readonly Guid applicationId; | ||
private readonly Guid archiveId; | ||
private readonly Layout layout; | ||
|
||
public RequestTest() | ||
{ | ||
this.fixture = new Fixture(); | ||
this.fixture.Customize(new SupportMutableValueTypesCustomization()); | ||
this.applicationId = this.fixture.Create<Guid>(); | ||
this.archiveId = this.fixture.Create<Guid>(); | ||
this.layout = this.fixture.Create<Layout>(); | ||
var fixture = new Fixture(); | ||
fixture.Customize(new SupportMutableValueTypesCustomization()); | ||
this.applicationId = fixture.Create<Guid>(); | ||
this.archiveId = fixture.Create<Guid>(); | ||
this.layout = fixture.Create<Layout>(); | ||
} | ||
|
||
[Fact] | ||
public void GetEndpointPath_ShouldReturnApiEndpoint() => | ||
ChangeLayoutRequest.Parse(this.applicationId, this.archiveId, this.layout) | ||
ChangeLayoutRequest.Build() | ||
.WithApplicationId(this.applicationId) | ||
.WithArchiveId(this.archiveId) | ||
.WithLayout(this.layout) | ||
.Create() | ||
.Map(request => request.GetEndpointPath()) | ||
.Should() | ||
.BeSuccess($"/v2/project/{this.applicationId}/archive/{this.archiveId}/layout"); | ||
|
||
[Fact] | ||
public void Parse_ShouldReturnFailure_GivenApplicationIdIsEmpty() => | ||
ChangeLayoutRequest.Parse(Guid.Empty, this.archiveId, this.layout) | ||
.Should() | ||
.BeFailure(ResultFailure.FromErrorMessage("ApplicationId cannot be empty.")); | ||
|
||
[Fact] | ||
public void Parse_ShouldReturnFailure_GivenArchiveIdIsEmpty() => | ||
ChangeLayoutRequest.Parse(this.applicationId, Guid.Empty, this.layout) | ||
.Should() | ||
.BeFailure(ResultFailure.FromErrorMessage("ArchiveId cannot be empty.")); | ||
|
||
[Fact] | ||
public void Parse_ShouldReturnSuccess_GivenAllValuesAreProvided() => | ||
ChangeLayoutRequest.Parse(this.applicationId, this.archiveId, this.layout) | ||
.Should() | ||
.BeSuccess(request => | ||
{ | ||
request.ApplicationId.Should().Be(this.applicationId); | ||
request.ArchiveId.Should().Be(this.archiveId); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
Vonage.Server.Test/Video/Archives/CreateArchive/SerializationTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.