public RateService(
     IRepository <Rate> RateRepository,
     IResourceClient <Rate> RateClient,
     LogFactory Factory)
 {
     this._RateRepository = RateRepository;
     this._RateClient     = RateClient;
     this._Logger         = Factory.GetCurrentClassLogger();
 }
        public TransactionServiceTest()
        {
            var LogFactory = NLog.LogManager.LoadConfiguration("NLog.config");

            var TestRateService = new RateService(new RateRepositoryMock(), new RateClientMock(), LogFactory);

            this.TestClient  = new TransactionClientMock();
            this.TestService = new TransactionService(new TransactionRepositoryMock(), this.TestClient, TestRateService, LogFactory);
        }
 public TransactionService(
     IRepository <Transaction> TransactionRepository,
     IResourceClient <Transaction> TransactionClient,
     IRateService RateService,
     LogFactory Factory)
 {
     this._TransactionRepository = TransactionRepository;
     this._TransactionClient     = TransactionClient;
     this._RateService           = RateService;
     this._Logger = Factory.GetCurrentClassLogger();
 }
        public GenerateProxyWindowControl()
        {
            _isInitialized = false;
            var factory = new IdentityServerUmaManagerClientFactory();
            var identityServerClientFactory = new IdentityServerClientFactory();

            _clientAuthSelector = identityServerClientFactory.CreateTokenClient();
            _resourceClient     = factory.GetResourceClient();
            InitializeComponent();
            Loaded += Load;
        }
Example #5
0
        public static DateTime?GetWarningDate(IResourceClient rc)
        {
            var authExpWarning = Properties.Current.AuthExpWarning;

            if (!rc.Expiration.HasValue)
            {
                return(null);
            }
            DateTime result = rc.Expiration.Value.AddDays(-30 * authExpWarning * rc.AuthDuration);

            return(result);
        }
 public EasyAccessCrudService(IOptions <EasyAccessConfig> options,
                              IEasyAccessDatabaseService dbService,
                              IEasyAccessStandardInstanceMapper instanceMapper,
                              IEasyAccessCommentMapper commentMapper,
                              IResourceClient <HttpClient> easyAccessResourceClient)
 {
     _dbService      = dbService;
     _settings       = options.Value;
     _instanceMapper = instanceMapper;
     _commentMapper  = commentMapper;
     _resourceClient = easyAccessResourceClient;
 }
 public JiraCrudService(
     IDatabaseService dbService,
     IOptions <ConfigSettings> configSettingsOptions,
     IResourceClient <Jira> client,
     IStandardInstanceMapper <IStandardInstance, Issue> issueMapper,
     IStandardCommentMapper <IStandardComment, Comment> commentMapper)
 {
     _configSettings = configSettingsOptions.Value;
     _dbService      = dbService;
     _resourceClient = client;
     _issueMapper    = issueMapper;
     _commentMapper  = commentMapper;
 }
Example #8
0
 private void AssertResourceClient(IResourceClient rc)
 {
     Assert.AreEqual(22124, rc.ResourceClientID);
     Assert.AreEqual(54040, rc.ResourceID);
     Assert.AreEqual(1301, ((IPrivileged)rc).ClientID);
     Assert.AreEqual("jgett", rc.UserName);
     Assert.AreEqual((ClientPrivilege)3942, rc.Privs);
     Assert.AreEqual((ClientAuthLevel)8, rc.AuthLevel);
     Assert.AreEqual(null, rc.Expiration);
     Assert.AreEqual(0, rc.EmailNotify);
     Assert.AreEqual(null, rc.PracticeResEmailNotify);
     Assert.AreEqual("ACS 200 cluster tool", rc.ResourceName);
     Assert.AreEqual(12, rc.AuthDuration);
     Assert.AreEqual("Getty, James", rc.DisplayName);
     Assert.AreEqual("*****@*****.**", rc.Email);
     Assert.AreEqual(true, rc.ClientActive);
     Assert.AreEqual(true, rc.ResourceIsActive);
 }
        public async static Task TestResource <TClientResource>(
            IResourceClient <TClientResource> client,
            Func <TClientResource> createFactory,
            Func <TClientResource, TClientResource> updateFactory,
            Func <EquivalencyAssertionOptions <TClientResource>, EquivalencyAssertionOptions <TClientResource> > options,
            IAuthenticator authenticator = null)
            where TClientResource : IClientResource
        {
            // Authenticate
            if (authenticator != null)
            {
                (await authenticator.Authenticate()).Should().BeTrue();
            }

            // Should be empty
            (await client.GetAllAsync()).Should().BeEmpty();

            // Add resource
            var addModel = createFactory.Invoke();
            var created  = await client.CreateAsync(addModel);

            created.Should().BeEquivalentTo(addModel, options);
            (await client.GetAllAsync()).First().Should().BeEquivalentTo(created, options);

            // Update resource
            var updatedModel = updateFactory.Invoke(created);

            (await client.CreateOrUpdateAsync(updatedModel.Id, updatedModel)).Should().BeEquivalentTo(updatedModel, options);
            (await client.GetAsync(updatedModel.Id)).Should().BeEquivalentTo(updatedModel, options);

            // Delete resource
            await client.DeleteAsync(updatedModel.Id);

            (await client.GetAllAsync()).Should().BeEmpty();

            // Unauthenticate
            if (authenticator != null)
            {
                (await authenticator.Unauthenticate()).Should().BeTrue();
            }

            return;
        }
Example #10
0
 public ExercisesController(IResourceClient resourceClient)
 {
     _resourceClient = resourceClient;
 }
Example #11
0
 private static IAuthorized AsAuthorized(IResourceClient rc)
 {
     return(rc);
 }
Example #12
0
 public PostWriter(string jekyllRootFolder, IResourceClient web, IFileSystem fileSystem)
 {
     _jekyllRootFolder = jekyllRootFolder;
     _web = web;
     _fs  = fileSystem;
 }
Example #13
0
        private static async Task <IEnumerable <Product> > SortByRecommended(IEnumerable <Product> products, IResourceClient resourceClient)
        {
            var shoppersHistory = await resourceClient.GetShoppersHistory();

            var productsSaleHistory = shoppersHistory.SelectMany(history => history.Products)
                                      .GroupBy(product => product.Name)
                                      .Select(
                grouping => new
            {
                ProductName   = grouping.Key,
                TotalQuantity = grouping.Sum(product => product.Quantity)
            });

            var currentProductsWithTheirSalesHistory =
                from product in products
                join productSaleHistory in productsSaleHistory on product.Name equals productSaleHistory.ProductName into gj
                from gr in gj.DefaultIfEmpty()
                select new
            {
                Product      = product,
                SaleQuantity = gr?.TotalQuantity ?? 0
            };

            return(currentProductsWithTheirSalesHistory
                   .OrderByDescending(product => product.SaleQuantity)
                   .Select(product => product.Product));
        }
Example #14
0
 public static Task <IEnumerable <Product> > Sort(SortOption sortOption, IEnumerable <Product> products, IResourceClient resourceClient)
 {
     return(Sorters[sortOption](products, resourceClient));
 }
 public JiraStandardCommentMapper(IDatabaseService dbService, IResourceClient <Jira> client, IOptions <ConfigSettings> configSettingsOptions)
 {
     _dbService      = dbService;
     _resourceClient = client;
     _configSettings = configSettingsOptions.Value;
 }