public async Task Index_WhenUserIsAuthenticatedWithoutAccessToContacts_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithHasAcquiredMicrosoftGraphTokenEqualToFalse() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasContactsClaimType: false); Controller sut = CreateSut(claimsPrincipal); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.HasAcquiredMicrosoftGraphToken, Is.False); }
public async Task Index_WhenUserIsAuthenticatedWithoutAccessToAccountings_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithAccountingNumberEqualToNull() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasAccountingClaimType: false); Controller sut = CreateSut(claimsPrincipal); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.AccountingNumber, Is.Null); }
public async Task Index_WhenUserIsAuthenticatedWithoutAccessToContacts_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithUpcomingBirthdaysWithinDaysEqualToDefaultValue() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasContactsClaimType: false); Controller sut = CreateSut(claimsPrincipal); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.UpcomingBirthdaysWithinDays, Is.EqualTo(default(int))); }
public async Task Index_WhenUserIsAuthenticatedWithAccessToContactsAndNoMicrosoftGraphTokenWasReturnedFromTokenHelperFactory_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithinDaysEqualToDefaultValue() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasContactsClaimType: true); Controller sut = CreateSut(claimsPrincipal, false); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.UpcomingBirthdaysWithinDays, Is.EqualTo(default(int))); }
public async Task Index_WhenUserIsAuthenticatedWithAccessToContacts_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithCanAccessContactsEqualToTrue() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasContactsClaimType: true); Controller sut = CreateSut(claimsPrincipal); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.CanAccessContacts, Is.True); }
public async Task Index_WhenUserIsNotAuthenticated_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithCanAccessAccountingsEqualToFalse() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(false); Controller sut = CreateSut(claimsPrincipal); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.CanAccessAccountings, Is.False); }
public async Task Index_WhenUserIsAuthenticatedWithAccessToAccountingsAndAccountingNumberWasReturnedFromClaimResolver_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithAccountingNumberEqualToAccountingNumberFromClaimResolver() { ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasAccountingClaimType: true); int accountingNumber = _fixture.Create <int>(); Controller sut = CreateSut(claimsPrincipal, hasAccountingNumber: true, accountingNumber: accountingNumber); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.AccountingNumber, Is.EqualTo(accountingNumber)); }
public async Task Index_WhenUserIsAuthenticatedWithAccessToContactsAndMicrosoftGraphTokenWhichWillExpireWasReturnedFromTokenHelperFactory_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithUpcomingBirthdaysWithinDaysEqualToDefaultValue() { Mock <IRefreshableToken> refreshableTokenMock = _fixture.BuildRefreshableTokenMock(willExpireWithin: true); ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasContactsClaimType: true); Controller sut = CreateSut(claimsPrincipal, true, refreshableTokenMock.Object); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.UpcomingBirthdaysWithinDays, Is.EqualTo(default(int))); }
public async Task Index_WhenUserIsAuthenticatedWithAccessToContactsAndMicrosoftGraphTokenWhichWillNotExpireWasReturnedFromTokenHelperFactory_ReturnsViewResultWhereModelIsHomeOperationsViewModelWithHasAcquiredMicrosoftGraphTokenEqualToTrue() { Mock <IRefreshableToken> refreshableTokenMock = _fixture.BuildRefreshableTokenMock(); ClaimsPrincipal claimsPrincipal = CreateClaimsPrincipal(hasContactsClaimType: true); Controller sut = CreateSut(claimsPrincipal, true, refreshableTokenMock.Object); ViewResult result = (ViewResult)await sut.Index(); HomeOperationsViewModel homeOperationsViewModel = (HomeOperationsViewModel)result.Model; Assert.That(homeOperationsViewModel.HasAcquiredMicrosoftGraphToken, Is.True); }