public async Task Send_v2_to_v1() { using var ctx = new TestContext(); var compat = Substitute.For <ISonarrCompatibility>(); compat.Capabilities.Returns(new[] { new SonarrCapabilities { ArraysNeededForReleaseProfileRequiredAndIgnored = false } }.ToObservable()); var data = new SonarrReleaseProfile { Ignored = new List <string> { "one", "two", "three" } }; var sut = new SonarrReleaseProfileCompatibilityHandler(compat, ctx.Mapper); var result = await sut.CompatibleReleaseProfileForSendingAsync(data); result.Should().BeEquivalentTo(new SonarrReleaseProfileV1 { Ignored = "one,two,three" }); }
public void Receive_v2_to_v2() { using var ctx = new TestContext(); var compat = Substitute.For <ISonarrCompatibility>(); var dataV2 = new SonarrReleaseProfile { Ignored = new List <string> { "one", "two", "three" } }; var sut = new SonarrReleaseProfileCompatibilityHandler(compat, ctx.Mapper); var result = sut.CompatibleReleaseProfileForReceiving(JObject.Parse(ctx.SerializeJson(dataV2))); result.Should().BeEquivalentTo(dataV2); }