public async Task Populate_WhenServiceIsNotConfigured_ShouldShowTheSettingsPanel() { MockSubsonicService.SetHasValidSubsonicUrl(false); await Subject.Populate(); _mockDialogService.ShowSettingsCallCount.Should().Be(1); }
public async Task PopulateWhenServiceIsConfiguredShouldExecuteAGetRootResult() { MockSubsonicService.SetHasValidSubsonicUrl(true); await Task.Run(() => Subject.Populate()); _mockGetRootResult.ExecuteCallCount.Should().Be(1); MockSubsonicService.SetHasValidSubsonicUrl(false); }
public async Task PopulateWhenServiceIsConfiguredAndPingResultIsOkShouldExecuteAGetRootResult() { MockSubsonicService.SetHasValidSubsonicUrl(true); MockSubsonicService.Ping = () => new MockPingResult(); await Subject.Populate(); _mockGetRootResult.ExecuteCallCount.Should().Be(1); MockSubsonicService.SetHasValidSubsonicUrl(false); }
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); }
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); }
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); }
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); }