public async Task StartAddingAssociatedCompany_WhenTokenWasReturnedFromTokenHelperFactory_ReturnsPartialViewResultWhereModelIsContactOptionsViewModel() { Controller sut = CreateSut(); PartialViewResult result = (PartialViewResult)await sut.StartAddingAssociatedCompany(_fixture.Create <string>()); Assert.That(result.Model, Is.TypeOf <ContactOptionsViewModel>()); }
public async Task StartAddingAssociatedCompany_WhenNoTokenWasReturnedFromTokenHelperFactory_ReturnsUnauthorizedResult() { Controller sut = CreateSut(false); IActionResult result = await sut.StartAddingAssociatedCompany(_fixture.Create <string>()); Assert.That(result, Is.TypeOf <UnauthorizedResult>()); }
public async Task StartAddingAssociatedCompany_WhenTokenWasReturnedFromTokenHelperFactory_ReturnsPartialViewResultWhereViewNameIsEqualToAddingAssociatedCompanyPartial() { Controller sut = CreateSut(); PartialViewResult result = (PartialViewResult)await sut.StartAddingAssociatedCompany(_fixture.Create <string>()); Assert.That(result.ViewName, Is.EqualTo("_AddingAssociatedCompanyPartial")); }
public async Task StartAddingAssociatedCompany_WhenTokenWasReturnedFromTokenHelperFactory_ReturnsPartialViewResultWhereModelIsContactOptionsViewModelWhereCountriesIsNull() { Controller sut = CreateSut(); PartialViewResult result = (PartialViewResult)await sut.StartAddingAssociatedCompany(_fixture.Create <string>()); ContactOptionsViewModel contactOptionsViewModel = (ContactOptionsViewModel)result.Model; Assert.That(contactOptionsViewModel.Countries, Is.Null); }
public async Task StartAddingAssociatedCompany_WhenCalledWithCountryCode_AssertGetTokenAsyncWasCalledOnTokenHelperFactory() { Controller sut = CreateSut(); await sut.StartAddingAssociatedCompany(_fixture.Create <string>()); _tokenHelperFactoryMock.Verify(m => m.GetTokenAsync <IRefreshableToken>( It.Is <TokenType>(value => value == TokenType.MicrosoftGraphToken), It.IsAny <HttpContext>()), Times.Once); }
public async Task StartAddingAssociatedCompany_WhenTokenWasReturnedFromTokenHelperFactory_ReturnsPartialViewResultWhereModelIsContactOptionsViewModelWhereDefaultCountryCodeIsEqualToCountryCode() { Controller sut = CreateSut(); string countryCode = _fixture.Create <string>(); PartialViewResult result = (PartialViewResult)await sut.StartAddingAssociatedCompany(countryCode); ContactOptionsViewModel contactOptionsViewModel = (ContactOptionsViewModel)result.Model; Assert.That(contactOptionsViewModel.DefaultCountryCode, Is.EqualTo(countryCode)); }
public void StartAddingAssociatedCompany_WhenCountryCodeIsWhiteSpace_ThrowsArgumentNullException() { Controller sut = CreateSut(); ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.StartAddingAssociatedCompany(" ")); Assert.That(result.ParamName, Is.EqualTo("countryCode")); }