コード例 #1
0
        public async Task Populate_WhenServiceIsNotConfigured_ShouldShowTheSettingsPanel()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(false);

            await Subject.Populate();

            _mockDialogService.ShowSettingsCallCount.Should().Be(1);
        }
コード例 #2
0
        public async Task PopulateWhenServiceIsConfiguredShouldExecuteAGetRootResult()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(true);

            await Task.Run(() => Subject.Populate());

            _mockGetRootResult.ExecuteCallCount.Should().Be(1);

            MockSubsonicService.SetHasValidSubsonicUrl(false);
        }
コード例 #3
0
        public async Task PopulateWhenServiceIsConfiguredAndPingResultIsOkShouldExecuteAGetRootResult()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(true);
            MockSubsonicService.Ping = () => new MockPingResult();

            await Subject.Populate();

            _mockGetRootResult.ExecuteCallCount.Should().Be(1);

            MockSubsonicService.SetHasValidSubsonicUrl(false);
        }
コード例 #4
0
        public async Task Populate_WhenServiceIsNotConfigured_ShouldShowANotification()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(false);

            await Task.Run(() => Subject.Populate());

            MockDialogNotificationService.Showed.Count.Should().Be(1);
            const string expectedMessage =
                "You did not set up your connection. Please fill in you server address, username and password to start browsing.";

            MockDialogNotificationService.Showed[0].Message.Should().Be(expectedMessage);
        }
コード例 #5
0
        public async Task Populate_WhenServiceIsConfigured_WillRunAPingResult()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(true);
            var mockPingResult = new MockPingResult();
            var callCount      = 0;

            MockSubsonicService.Ping = () =>
            {
                callCount++;
                return(mockPingResult);
            };

            await Subject.Populate();

            callCount.Should().Be(1);
            mockPingResult.ExecuteCallCount.Should().Be(1);
        }
コード例 #6
0
        public async Task Populate_PingResultHasError_CallsErrorDialogViewModelHandle()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(true);
            var apiException = new ApiException(new Error {
                Message = "test_m"
            });
            var mockPingResult = new MockPingResult {
                GetErrorFunc = () => apiException
            };

            MockSubsonicService.Ping = () => mockPingResult;

            await Subject.Populate();

            MockErrorDialogViewModel.HandledErrors.Count().Should().Be(1);
            MockErrorDialogViewModel.HandledErrors.First().Should().Be(apiException);
        }
コード例 #7
0
        public async Task PopulateWhenResultIsSuccessfull()
        {
            MockSubsonicService.SetHasValidSubsonicUrl(true);
            MockSubsonicService.Ping            = () => new MockPingResult();
            MockSubsonicService.GetMusicFolders =
                () =>
                new MockGetRootResult
            {
                GetResultFunc =
                    () => new List <MusicFolder> {
                    new MusicFolder(), new MusicFolder()
                }
            };

            await Subject.Populate();

            Subject.MenuItems.Should().HaveCount(2);
        }