예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IdentificationLine"/> class.
 /// </summary>
 /// <param name="creationDate">The creation date.</param>
 /// <param name="bankIdentificationNumber">The bank identification number or zeros.</param>
 /// <param name="isDuplicate">Indication for duplicity.</param>
 /// <param name="applicationCode">The application code</param>
 /// <param name="fileReference">File reference as determined by the bank or blank</param>
 /// <param name="accountName">Name addressee</param>
 /// <param name="accountBic">Bic of the bank holding the account.</param>
 /// <param name="accountCompanyIdentificationNumber">Identification number of the Belgium-based account holder</param>
 /// <param name="externalApplicationCode">code "seperate application"</param>
 /// <param name="transactionReference">Transaction reference or blank.</param>
 /// <param name="relatedReference">Related reference or blank.</param>
 /// <param name="versionCode">The version code.</param>
 public IdentificationLine(
     Date creationDate,
     BankIdentificationNumber bankIdentificationNumber,
     bool isDuplicate,
     ApplicationCode applicationCode,
     FileReference fileReference,
     AccountName accountName,
     Bic accountBic,
     CompanyIdentificationNumber accountCompanyIdentificationNumber,
     ExternalApplicationCode externalApplicationCode,
     TransactionReference transactionReference,
     RelatedReference relatedReference,
     VersionCode versionCode)
 {
     CreationDate             = creationDate;
     BankIdentificationNumber = bankIdentificationNumber;
     IsDuplicate     = isDuplicate;
     ApplicationCode = applicationCode;
     FileReference   = fileReference;
     AccountName     = accountName;
     AccountBic      = accountBic;
     AccountCompanyIdentificationNumber = accountCompanyIdentificationNumber;
     ExternalApplicationCode            = externalApplicationCode;
     TransactionReference = transactionReference;
     RelatedReference     = relatedReference;
     VersionCode          = versionCode;
 }
 public ApplicationCodeAuthKeyValidateRequest(
     ApplicationCode requestingApplicationCode,
     ApplicationCode targetApplicationCode,
     AuthKeyValue key)
 {
     RequestingApplicationCode = requestingApplicationCode;
     TargetApplicationCode     = targetApplicationCode;
     Key = key;
 }
        public Task <KeyApplication> GetApplicationByCodeAsync(
            ApplicationCode applicationCode,
            CancellationToken token = default)
        {
            if (!_codeDictionary.TryGetValue(applicationCode, out var app))
            {
                return(Task.FromResult(KeyApplication.NoApplication));
            }

            return(Task.FromResult(app));
        }
예제 #4
0
        public async Task GetApp_2BindedApp1Disabled_Return1ActiveApp()
        {
            // ARRANGE
            ApplicationCode applicationCode   = "1";
            KeyApplication  application       = new KeyApplication(applicationCode, Guid.NewGuid());
            var             activeBindedApp   = new KeyApplication("2", Guid.NewGuid());
            var             disabledBindedApp = new KeyApplication("3", Guid.NewGuid());

            KeyApplication[] bindedApplications = { activeBindedApp, disabledBindedApp };

            // настраиваем репу приложения, находим наше приложение
            // а так же возвращаем список из двух приложений
            var appRepoMock = new Mock <IApplicationRepository>();

            appRepoMock.Setup(x => x.GetApplicationByCodeAsync(applicationCode, default))
            .Returns(() => Task.FromResult(application));

            appRepoMock.Setup(x => x.GetKnownApplicationsAsync(application, default))
            .Returns(() => Task.FromResult <IEnumerable <KeyApplication> >(bindedApplications));

            // настраиваем реп ключей, чтобы он для одного из аппов не нашёл активного ключа
            var keyRepoMock = new Mock <IKeyRepository>();

            keyRepoMock.Setup(x => x.IsHaveActiveAuthKey(activeBindedApp, application, default))
            .Returns(() => new ValueTask <bool>(Task.FromResult(true)));

            keyRepoMock.Setup(x => x.IsHaveActiveAuthKey(disabledBindedApp, application, default))
            .Returns(() => new ValueTask <bool>(Task.FromResult(false)));

            var validator = _commonHelper.InitValidator(appRepoMock.Object, keyRepoMock.Object);

            // ACT

            var result = await validator.GetPermittedApplicationsAsync(applicationCode);

            // ASSERT

            KeyApplication[] expectedResult = { activeBindedApp };

            Assert.True(_commonHelper.CheckIsApplicationListsEqual(result, expectedResult));
        }
예제 #5
0
        public async Task GetApp_RequestedAppNotFound_ReturnEmptyList()
        {
            // ARRANGE
            ApplicationCode applicationCode = "1";

            // настраиваем репу приложения, чтобы оно не находило ничего
            var appRepoMock = new Mock <IApplicationRepository>();

            appRepoMock.Setup(x => x.GetApplicationByCodeAsync(applicationCode, default))
            .Returns(() => Task.FromResult(KeyApplication.NoApplication));

            var validator = _commonHelper.InitValidator(appRepoMock.Object);

            // ACT

            var result = await validator.GetPermittedApplicationsAsync(applicationCode);

            // ASSERT

            Assert.True(_commonHelper.CheckIsEmpty(result));
        }
 public static bool IsIndividualEntrepreneur(this ApplicationCode code) =>
 IndividualEntrepreneurCodes.Contains(code);
        public void IsIndividualEntrepreneur_should_indicate_that_application_code_is_belong_to_legal_entity(ApplicationCode applicationCode)
        {
            var isIndividualEntrepreneurCode = applicationCode.IsIndividualEntrepreneur();

            isIndividualEntrepreneurCode.Should().BeFalse();
        }
 public Task <KeyApplication> GetApplicationByCodeAsync(ApplicationCode applicationCode, CancellationToken token = default)
 {
     return(Task.FromResult(KeyApplication.NoApplication));
 }