Skip to content

Commit

Permalink
feat: implement E2E for Start on ExperienceComposer
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Jun 25, 2024
1 parent c989a09 commit 03f9e7a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
31 changes: 31 additions & 0 deletions Vonage.Test/Video/ExperienceComposer/Start/E2ETest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.Net;
using System.Threading.Tasks;
using Vonage.Test.Common.Extensions;
using WireMock.ResponseBuilders;
using Xunit;

namespace Vonage.Test.Video.ExperienceComposer.Start;

[Trait("Category", "E2E")]
public class E2ETest : E2EBase
{
public E2ETest() : base(typeof(E2ETest).Namespace)
{
}

[Fact]
public async Task Start()
{
this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create()
.WithPath("/v2/project/e3e78a75-221d-41ec-8846-25ae3db1943a/render")
.WithHeader("Authorization", this.Helper.ExpectedAuthorizationHeaderValue)
.WithBody(this.Serialization.GetRequestJson(nameof(SerializationTest.ShouldSerialize)))
.UsingPost())
.RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK)
.WithBody(this.Serialization.GetResponseJson(nameof(SessionSerializationTest.ShouldDeserialize200))));
await this.Helper.VonageClient.VideoClient.ExperienceComposerClient
.StartAsync(SerializationTest.BuildRequest())
.Should()
.BeSuccessAsync(SessionSerializationTest.BuildExpectedSession());
}
}
24 changes: 14 additions & 10 deletions Vonage.Test/Video/ExperienceComposer/Start/SerializationTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Vonage.Common.Monads;
using Vonage.Serialization;
using Vonage.Server;
using Vonage.Test.Common;
Expand All @@ -16,17 +17,20 @@ public class SerializationTest
JsonSerializerBuilder.BuildWithCamelCase());

[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()
public void ShouldSerialize() => BuildRequest()
.GetStringContent()
.Should()
.BeSuccess(this.helper.GetRequestJson());

internal static Result<StartRequest> BuildRequest() =>
StartRequest
.Build()
.WithApplicationId(new Guid("e3e78a75-221d-41ec-8846-25ae3db1943a"))
.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();
}

0 comments on commit 03f9e7a

Please sign in to comment.