private void SetupContext()
        {
            var ovoNumber = new OvoNumber("OVO000015");

            _dataVlaanderenProviderMock = new Mock <IDataVlaanderenProvider>();
            _wegwijsProviderMock        = new Mock <IWegwijsProvider>();

            _dataVlaanderenProviderMock
            .Setup(provider => provider.GetOrganisationAsync(ovoNumber))
            .ReturnsAsync(() => Optional <Organisation> .Empty);

            _dataVlaanderenProviderMock
            .Setup(provider => provider.GetOrganisationNotFoundMessage())
            .Returns("data.vlaanderen: not found");

            _wegwijsProviderMock
            .Setup(provider => provider.GetOrganisationAsync(ovoNumber))
            .ThrowsAsync(new Exception());

            _wegwijsProviderMock
            .Setup(provider => provider.GetOrganisationFailedMessage())
            .Returns("wegwijs: failed");

            var sut = new OrganisationProvider(
                Mock.Of <ILogger <OrganisationProvider> >(),
                _dataVlaanderenProviderMock.Object,
                _wegwijsProviderMock.Object);

            _act = () => sut.GetOrganisationAsync(ovoNumber).GetAwaiter().GetResult();
        }
Beispiel #2
0
        public WhenRequestingAnOrganisationWhichIsNotFoundInDataVlaanderen()
        {
            SetupContext();

            _sut.GetOrganisationAsync(_ovoNumber).GetAwaiter().GetResult();
        }
Beispiel #3
0
        public WhenRequestingAnOrganisationWhichCausesDataVlaanderenToError()
        {
            SetupContext();

            _sut.GetOrganisationAsync(_ovoNumber).GetAwaiter().GetResult();
        }
Beispiel #4
0
        public WhenRequestingAnOrganisationFoundInTheFallBackWegWijsSource()
        {
            SetupContext();

            _requestedOrganisation = _sut.GetOrganisationAsync(_ovoNumber).GetAwaiter().GetResult();
        }