Example #1
0
        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>());
        }
Example #2
0
        public async Task StartAddingAssociatedCompany_WhenNoTokenWasReturnedFromTokenHelperFactory_ReturnsUnauthorizedResult()
        {
            Controller sut = CreateSut(false);

            IActionResult result = await sut.StartAddingAssociatedCompany(_fixture.Create <string>());

            Assert.That(result, Is.TypeOf <UnauthorizedResult>());
        }
Example #3
0
        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"));
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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));
        }
Example #7
0
        public void StartAddingAssociatedCompany_WhenCountryCodeIsWhiteSpace_ThrowsArgumentNullException()
        {
            Controller sut = CreateSut();

            ArgumentNullException result = Assert.ThrowsAsync <ArgumentNullException>(async() => await sut.StartAddingAssociatedCompany(" "));

            Assert.That(result.ParamName, Is.EqualTo("countryCode"));
        }