-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement serialization for Start on ExperienceComposer
- Loading branch information
Showing
5 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
Vonage.Test/Video/ExperienceComposer/Start/Data/ShouldDeserialize200-response.json
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,14 @@ | ||
{ | ||
"id": "1248e7070b81464c9789f46ad10e7764", | ||
"sessionId": "flR1ZSBPY3QgMjkgMTI6MTM6MjMgUERUIDIwMTN", | ||
"applicationId": "93e36bb9-b72c-45b6-a9ea-5c37dbc49906", | ||
"createdAt": 1437676551000, | ||
"callbackUrl": "https://example.com/video/events", | ||
"updatedAt": 1437676551000, | ||
"name": "Composed stream for Live event #1", | ||
"url": "https://example.com/", | ||
"resolution": "720x1280", | ||
"status": "failed", | ||
"streamId": "e32445b743678c98230f238", | ||
"reason": "Could not load URL" | ||
} |
10 changes: 10 additions & 0 deletions
10
Vonage.Test/Video/ExperienceComposer/Start/Data/ShouldSerialize-request.json
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,10 @@ | ||
{ | ||
"sessionId": "flR1ZSBPY3QgMjkgMTI6MTM6MjMgUERUIDIwMTN", | ||
"token": "830c9c9d-d09e-4513-9cc8-29c90a760248", | ||
"url": "https://example.com/", | ||
"maxDuration": 1800, | ||
"resolution": "640x480", | ||
"properties": { | ||
"name": "Composed stream for Live event #1" | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
Vonage.Test/Video/ExperienceComposer/Start/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using Vonage.Serialization; | ||
using Vonage.Server; | ||
using Vonage.Test.Common; | ||
using Vonage.Test.Common.Extensions; | ||
using Vonage.Video.ExperienceComposer; | ||
using Vonage.Video.ExperienceComposer.Start; | ||
using Xunit; | ||
|
||
namespace Vonage.Test.Video.ExperienceComposer.Start; | ||
|
||
[Trait("Category", "Serialization")] | ||
public class SerializationTest | ||
{ | ||
private readonly SerializationTestHelper helper = new SerializationTestHelper( | ||
typeof(SerializationTest).Namespace, | ||
JsonSerializerBuilder.BuildWithCamelCase()); | ||
|
||
[Fact] | ||
public void ShouldDeserialize200() => this.helper.Serializer | ||
.DeserializeObject<Session>(this.helper.GetResponseJson()) | ||
.Should() | ||
.BeSuccess(BuildExpectedSession()); | ||
|
||
[Fact] | ||
public void ShouldSerialize() => StartRequest | ||
.Build() | ||
.WithApplicationId(Guid.NewGuid()) | ||
.WithSessionId("flR1ZSBPY3QgMjkgMTI6MTM6MjMgUERUIDIwMTN") | ||
.WithToken("830c9c9d-d09e-4513-9cc8-29c90a760248") | ||
.WithUrl(new Uri("https://example.com/")) | ||
.WithResolution(RenderResolution.StandardDefinitionLandscape) | ||
.WithName("Composed stream for Live event #1") | ||
.WithMaxDuration(1800) | ||
.Create() | ||
.GetStringContent() | ||
.Should() | ||
.BeSuccess(this.helper.GetRequestJson()); | ||
|
||
internal static Session BuildExpectedSession() => | ||
new Session("1248e7070b81464c9789f46ad10e7764", | ||
"flR1ZSBPY3QgMjkgMTI6MTM6MjMgUERUIDIwMTN", | ||
new Guid("93e36bb9-b72c-45b6-a9ea-5c37dbc49906"), | ||
1437676551000, | ||
new Uri("https://example.com/video/events"), | ||
1437676551000, | ||
"Composed stream for Live event #1", | ||
new Uri("https://example.com/"), | ||
RenderResolution.HighDefinitionPortrait, | ||
SessionStatus.Failed, | ||
"e32445b743678c98230f238", | ||
"Could not load URL"); | ||
} |
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