public void WhenFirstRun_LoadAppointmentsAndShowSettingsWithDataFromFirstAppointment() { // Arrange var appService = new ServerAppService(_repositoryMock.Object, _apiMock.Object, _dentalApiFactoryServiceMock.Object, _clientCallbackServiceMock.Object); // Act DispatcherHelper.WaitWithDispatcher(1000); // Assert AssertLoadingIndicator(); _dialogServiceMock.Verify(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never, "Shouldn't have popup messages"); _apiMock.Verify(m => m.RegisterPlugin(It.IsAny <RegisterPluginRequest>()), Times.Never, "Shouldn't register plugin"); Assert.AreEqual(ServerState.Ready, appService.GetState()); _dentalApiMock.Verify(m => m.GetAppointmentsForToday(), Times.Once); _apiMock.Verify(m => m.Initialize(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never, "Should not initialize Chewsi API"); AssertClaims(appService.GetClaims(true), _appointmentsPms); _settingsViewModelMock.Verify(m => m.InjectAppServiceAndInit(It.IsAny <IClientAppService>(), It.IsAny <SettingsDto>()), Times.Once, "Should fill settings with values from appointment"); _settingsViewModelMock.Verify(m => m.Show(It.IsAny <Action>()), Times.Once, "Should show settings popup"); }
public void WhenNotFirstRun_ShouldDisplayAppointmentsOnlyFromPms() { // Arrange // Act var appService = new ServerAppService(_repositoryMock.Object, _apiMock.Object, _dentalApiFactoryServiceMock.Object, _clientCallbackServiceMock.Object); DispatcherHelper.WaitWithDispatcher(1000); // Assert AssertLoadingIndicator(); _dialogServiceMock.Verify(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never, "Shouldn't have popup messages"); _apiMock.Verify(m => m.RegisterPlugin(It.IsAny <RegisterPluginRequest>()), Times.Never, "Shouldn't register plugin"); Assert.AreEqual(ServerState.Ready, appService.GetState()); _dentalApiMock.Verify(m => m.GetAppointmentsForToday(), Times.Once); _apiMock.Verify(m => m.Initialize(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once, "Should initialize Chewsi API"); _apiMock.Verify(m => m.GetClaimProcessingStatus(It.IsAny <ClaimProcessingStatusRequest>()), Times.Never, "Should not load claim statuses from Chewsi API"); AssertClaims(appService.GetClaims(true), _appointmentsPms); _settingsViewModelMock.Verify(m => m.InjectAppServiceAndInit(It.IsAny <IClientAppService>(), It.IsAny <SettingsDto>()), Times.Never, "Should not touch settings model"); _settingsViewModelMock.Verify(m => m.Show(It.IsAny <Action>()), Times.Never, "Should not show settings popup"); }
public void WhenRepositoryIsNotInitialized_DontCallChewsiApiItAndNoMessage() { // Arrange _repositoryMock.Setup(m => m.Ready).Returns(false); // Act var appService = new ServerAppService(_repositoryMock.Object, _apiMock.Object, _dentalApiFactoryServiceMock.Object, _clientCallbackServiceMock.Object); // Assert //AssertLoadingIndicator(); Assert.IsFalse(_loadingIndicatorShown, "Loading is not hidden"); _dialogServiceMock.Verify(m => m.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never, "Shouldn't have popup messages"); _apiMock.Verify(m => m.RegisterPlugin(It.IsAny <RegisterPluginRequest>()), Times.Never, "Shouldn't register plugin"); Assert.AreEqual(ServerState.InvalidSettings, appService.GetState()); }