Exemplo n.º 1
0
        public async Task AfterDeleteAsync(List <Guid> lstObjectsToValidate, IParams parameters)
        {
            LicenseParams licenseParams = parameters as LicenseParams;

            var service = new LicensingService(LicensingServiceProviderFactory.GetProvider());

            service.AumentEmployeeLicense(licenseParams.LicenseID, licenseParams.LicenseServiceID);
        }
Exemplo n.º 2
0
        public async Task AfterUnregistered(IEnumerable <Guid> idsToUpdate, Guid identityWorkId, params object[] parameters)
        {
            LicenseParams licenseParams = parameters[0] as LicenseParams;
            var           service       = new LicensingService(LicensingServiceProviderFactory.GetProvider());

            service.AumentEmployeeLicense(licenseParams.LicenseID, licenseParams.LicenseServiceID);
            //Vacío (corte)
        }
Exemplo n.º 3
0
            public async Task Should_Get_Cotorria_License_Then_Consume_Employeee_Then_Unconsume_Employee()
            {
                var service         = new LicensingService(LicensingServiceProviderFactory.GetProvider());
                var LoginServiceURL = ConfigManager.GetValue("LoginServiceHost");

                var token = await LicensingServiceCotorraProviderUT.LoginAsync("*****@*****.**", "Xq63zqw@", LoginServiceURL + "api/Auth/LoginUser");

                //Get license info
                var licenseinfo = await service.GetLicensesUserByAppAsync(token, CotorriaAppID);

                Assert.NotEmpty(licenseinfo);
                var license          = licenseinfo.FirstOrDefault();
                var CotorriaApp      = license.Apps.Where(x => x.AppID == CotorriaAppID).FirstOrDefault();
                var licenseServiceID = CotorriaApp.LicenseServiceID;
                // get feature info
                var employeeFeature         = CotorriaApp.Features.FirstOrDefault(x => x.ID == EmployeesFeature);
                var initialEmployeesApplied = employeeFeature.Applied;

                //Act
                await service.ConsumeEmployeeLicense(license.LicenseID, licenseServiceID);

                //Get For Assert
                licenseinfo = await service.GetLicensesUserByAppAsync(token, CotorriaAppID);

                Assert.NotEmpty(licenseinfo);
                license          = licenseinfo.FirstOrDefault();
                CotorriaApp      = license.Apps.Where(x => x.AppID == CotorriaAppID).FirstOrDefault();
                licenseServiceID = CotorriaApp.LicenseServiceID;
                employeeFeature  = CotorriaApp.Features.FirstOrDefault(x => x.ID == EmployeesFeature);
                var actualEmployees = employeeFeature.Applied;

                //Asert
                Assert.Equal(initialEmployeesApplied + 1, actualEmployees);

                //Act Again
                await service.AumentEmployeeLicense(license.LicenseID, licenseServiceID);


                //Get For Assert again
                licenseinfo = await service.GetLicensesUserByAppAsync(token, CotorriaAppID);

                Assert.NotEmpty(licenseinfo);
                license          = licenseinfo.FirstOrDefault();
                CotorriaApp      = license.Apps.Where(x => x.AppID == CotorriaAppID).FirstOrDefault();
                licenseServiceID = CotorriaApp.LicenseServiceID;
                employeeFeature  = CotorriaApp.Features.FirstOrDefault(x => x.ID == EmployeesFeature);
                actualEmployees  = employeeFeature.Applied;

                Assert.Equal(initialEmployeesApplied, actualEmployees);
            }