private async Task ThenAllLocalLibrariesArchived()
        {
            var result = await _commandAction();

            result.IsSuccessful.Should().BeTrue();

            _plexServer.Should().NotBeNull();
            _plexServer.Should().BeEquivalentTo(_plexServer, options => options.Excluding(x => x.PlexLibraries));

            foreach (var library in _plexServer.PlexLibraries)
            {
                library.IsArchived.Should().BeTrue();
                library.IsEnabled.Should().BeFalse();
            }
        }
Ejemplo n.º 2
0
        private void ThenAServerWasCreated(bool createdLibraries)
        {
            _commandAction.Should().NotThrow();

            _createdServer.Should().NotBeNull();
            var ownedServer = _plexServers.First(x => x.Owned == "1");

            _createdServer.AccessToken.Should().Be(ownedServer.AccessToken);
            _createdServer.Name.Should().Be(ownedServer.Name);
            _createdServer.LocalIp.Should().Be(LocalIp);
            _createdServer.LocalPort.Should().Be(_plexSettings.Value.DefaultLocalPort);
            _createdServer.ExternalIp.Should().Be(ownedServer.Address);
            _createdServer.ExternalPort.Should().Be(Convert.ToInt32(ownedServer.Port));
            _createdServer.Scheme.Should().Be(ownedServer.Scheme);

            if (createdLibraries)
            {
                var expectedLibraries = _plexLibraryContainer.MediaContainer.Directory.Select(x => new PlexLibraryRow
                {
                    LibraryKey = x.Key,
                    Title      = x.Title,
                    Type       = x.Type
                }).ToList();
                _createdServer.PlexLibraries.Should().BeEquivalentTo(expectedLibraries, options => options.Excluding(x => x.CreatedUtc));
            }
            else
            {
                _createdServer.PlexLibraries.Should().BeEmpty();
            }
        }