Exemple #1
0
    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"
        });
    }
Exemple #2
0
    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);
    }