public LegacyProfileConvertor(IConvertorArgs args, IAccountCollection accountCollection, ILogManager logManager, PluginInitializer initializer) : base(args, accountCollection) { _log = logManager.GetLogger(GetType()); _initializer = initializer; _externalDataConvertor = new LegacyExternalDataConvertor(_context); }
private QueryHandler CreateSut(bool hasAccountCollection = true, IAccountCollection accountCollection = null) { _accountingRepositoryMock.Setup(m => m.GetAccountsAsync(It.IsAny <int>(), It.IsAny <DateTime>())) .Returns(Task.FromResult(hasAccountCollection ? accountCollection ?? _fixture.BuildAccountCollectionMock().Object : null)); return(new QueryHandler(_validatorMock.Object, _accountingRepositoryMock.Object)); }
private Controller CreateSut(IAccountCollection accountCollection = null) { _queryBusMock.Setup(m => m.QueryAsync <IGetAccountCollectionQuery, IAccountCollection>(It.IsAny <IGetAccountCollectionQuery>())) .Returns(Task.FromResult(accountCollection ?? _fixture.BuildAccountCollectionMock().Object)); return(new Controller(_commandBusMock.Object, _queryBusMock.Object)); }
public IActionResult CreateNewAccount(CreateAccounViewModel model) { IAccountCollection accountCollection = _accountFactory.AccountCollection(); accountCollection.CreateAccount(new Account(model.Name, model.Password, model.IsActive)); return(RedirectToAction("Index", "Account")); }
public async Task GetAccountsAsync_WhenAccountingNumberDoesNotExist_ReturnsEmptyAccountCollection() { IAccountingRepository sut = CreateSut(); IAccountCollection result = await sut.GetAccountsAsync(WithNonExistingAccountingNumber(), DateTime.Today); Assert.That(result.Count(), Is.EqualTo(0)); }
public TradeMatchEngine(IAccountCollection accountCollection, ServiceAccount serviceAccount) { _AccountCollection = accountCollection; _ServiceAccount = serviceAccount; ActiveSellOrders = new Dictionary <string, TradeOrderBlock>(); ActiveBuyOrders = new Dictionary <string, TradeOrderBlock>(); LoadOrders(); }
public LegacyRevisionsImporter( IConvertorArgs args, IAccountCollection accountCollection, ILogManager logManager, PluginInitializer initializer) : base(args, accountCollection, logManager, initializer) { }
public IActionResult SaveEdit(ShowAllAccountsViewModel model) { IAccountCollection accountCollection = _accountFactory.AccountCollection(); accountCollection.Update(new Account(model.AccountId, model.Name, model.Password, model.Active)); return(RedirectToAction("Index", "Account")); }
public CheckIntervalElapsedMessageHandler(IBus bus, IPluginMetadata pluginMetadata, IAccountCollection collection, IMsmqTransport transport, ITaskFactory taskFactory) { _bus = bus; _pluginMetadata = pluginMetadata; _collection = collection; _transport = transport; _taskFactory = taskFactory; }
public async Task QueryAsync_WhenNoAccountCollectionWasReturnedFromAccountingRepository_ReturnsNotNull() { QueryHandler sut = CreateSut(false); IGetAccountCollectionQuery query = CreateQuery(); IAccountCollection result = await sut.QueryAsync(query); Assert.That(result, Is.Not.Null); }
public async Task QueryAsync_WhenNoAccountCollectionWasReturnedFromAccountingRepository_ReturnsEmptyAccountCollection() { QueryHandler sut = CreateSut(false); IGetAccountCollectionQuery query = CreateQuery(); IAccountCollection result = await sut.QueryAsync(query); Assert.That(result.Count(), Is.EqualTo(0)); }
protected PluginInfoSender() { _context = ObjectFactory.GetInstance<IPluginContext>(); _bus = ObjectFactory.GetInstance<ITpBus>(); PluginMetadata = ObjectFactory.GetInstance<IPluginMetadata>(); _accountCollection = ObjectFactory.GetInstance<IAccountCollection>(); _pluginQueueFactory = ObjectFactory.GetInstance<IPluginQueueFactory>(); _pluginSettings = ObjectFactory.GetInstance<IPluginSettings>(); _pluginIcon = ObjectFactory.GetInstance<PluginIcon>(); }
public async Task QueryAsync_WhenNoAccountCollectionWasReturnedFromAccountingRepository_ReturnsAccountCollectionWhereStatusDateIsEqualToStatusDateFromGetAccountCollectionQuery() { QueryHandler sut = CreateSut(false); DateTime statusDate = _fixture.Create <DateTime>().Date; IGetAccountCollectionQuery query = CreateQuery(statusDate: statusDate); IAccountCollection result = await sut.QueryAsync(query); Assert.That(result.StatusDate, Is.EqualTo(statusDate)); }
public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhichContainsAccountCollectionMatchingEachAccountGroupFromAccountsInAccountCollection() { IAccountCollection sut = CreateSut(); sut.Add(CreateAccountCollection()); IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync(); Assert.That(result.All(item => item.Value.All(account => account.AccountGroup.Number == item.Key.Number)), Is.True); }
public void ValuesAtEndOfLastMonthFromStatusDate_WhenCalculateAsyncHasNotBeenCalled_ReturnsAccountCollectionValuesWhereLiabilitiesIsEqualToZero() { IAccountCollection sut = CreateSut(); sut.Add(_fixture.CreateMany <IAccount>(_random.Next(5, 10)).ToArray()); IAccountCollectionValues result = sut.ValuesAtEndOfLastMonthFromStatusDate; Assert.That(result.Liabilities, Is.EqualTo(0M)); }
public void ValuesAtEndOfLastMonthFromStatusDate_WhenCalculateAsyncHasNotBeenCalled_ReturnsNotNull() { IAccountCollection sut = CreateSut(); sut.Add(_fixture.CreateMany <IAccount>(_random.Next(5, 10)).ToArray()); IAccountCollectionValues result = sut.ValuesAtEndOfLastMonthFromStatusDate; Assert.That(result, Is.Not.Null); }
public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsNotNull() { IAccountCollection sut = CreateSut(); sut.Add(CreateAccountCollection()); IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync(); Assert.That(result, Is.Not.Null); }
public async Task CalculateAsync_WhenCalled_ReturnsSameCalculableWithCalculatedAccountCollection() { IAccountCollection calculatedAccountCollection = _fixture.BuildAccountCollectionMock().Object; IAccountCollection accountCollection = _fixture.BuildAccountCollectionMock(calculatedAccountCollection: calculatedAccountCollection).Object; ICalculable <IAccounting> sut = CreateSut(accountCollection: accountCollection); IAccounting result = await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); Assert.That(result.AccountCollection, Is.EqualTo(calculatedAccountCollection)); }
public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhichContainsAllAccountsInAccountCollection() { IAccountCollection sut = CreateSut(); IAccount[] accountCollection = CreateAccountCollection(); sut.Add(accountCollection); IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync(); Assert.That(accountCollection.All(account => result.SelectMany(item => item.Value).Contains(account)), Is.True); }
public async Task QueryAsync_WhenAccountCollectionWasReturnedFromAccountingRepository_ReturnsCalculatedAccountCollection() { IAccountCollection calculatedAccountCollection = _fixture.BuildAccountCollectionMock().Object; IAccountCollection accountCollection = _fixture.BuildAccountCollectionMock(calculatedAccountCollection: calculatedAccountCollection).Object; QueryHandler sut = CreateSut(accountCollection: accountCollection); IGetAccountCollectionQuery query = CreateQuery(); IAccountCollection result = await sut.QueryAsync(query); Assert.That(result, Is.EqualTo(calculatedAccountCollection)); }
public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhereAllAccountCollectionsIsCalculated() { IAccountCollection sut = CreateSut(); sut.Add(CreateAccountCollection()); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await(await sut.CalculateAsync(statusDate)).GroupByAccountGroupAsync(); Assert.That(result.Select(item => item.Value.StatusDate).All(value => value == statusDate.Date), Is.True); }
public ForumController() { forumCategory = LogicFactory.LogicFactory.GetForumCategory(); forumCategoryCollection = LogicFactory.LogicFactory.GetForumCategoryCollection(); forumThread = LogicFactory.LogicFactory.GetForumThread(); forumThreadCollection = LogicFactory.LogicFactory.GetForumThreadCollection(); forumPost = LogicFactory.LogicFactory.GetForumPost(); forumPostCollection = LogicFactory.LogicFactory.GetForumPostCollection(); account = LogicFactory.LogicFactory.GetAccount(); accountCollection = LogicFactory.LogicFactory.GetAccountCollection(); }
public async Task GroupByAccountGroupAsync_WhenCalled_ReturnsReadOnlyDictionaryWhichContainsEachAccountGroupFromAccountsInAccountCollection() { IAccountCollection sut = CreateSut(); IAccountGroup[] accountGroupCollection = _fixture.CreateMany <IAccountGroup>(_random.Next(2, 5)).ToArray(); sut.Add(CreateAccountCollection(accountGroupCollection)); IReadOnlyDictionary <IAccountGroup, IAccountCollection> result = await sut.GroupByAccountGroupAsync(); Assert.That(accountGroupCollection.All(accountGroup => result.Keys.Single(key => key.Number == accountGroup.Number) != null), Is.True); }
public async Task <ActionResult <AccountCollectionModel> > AccountsAsync(int accountingNumber, DateTimeOffset?statusDate = null) { IGetAccountCollectionQuery query = new GetAccountCollectionQuery { AccountingNumber = accountingNumber, StatusDate = statusDate?.LocalDateTime.Date ?? DateTime.Today }; IAccountCollection accountCollection = await _queryBus.QueryAsync <IGetAccountCollectionQuery, IAccountCollection>(query); AccountCollectionModel accountCollectionModel = _accountingModelConverter.Convert <IAccountCollection, AccountCollectionModel>(accountCollection); return(new OkObjectResult(accountCollectionModel)); }
public async Task GroupByAccountGroupAsync_WhenCalled_AssertAccountNumberWasCalledOnEachAccountInAccountCollection() { IAccountCollection sut = CreateSut(); Mock <IAccount>[] accountMockCollection = CreateAccountMockCollection(); sut.Add(accountMockCollection.Select(accountMock => accountMock.Object).ToArray()); await sut.GroupByAccountGroupAsync(); foreach (Mock <IAccount> accountMock in accountMockCollection) { accountMock.Verify(m => m.AccountNumber, Times.Once); } }
public async Task AccountsAsync_WhenCalled_ReturnsOkObjectResultWhereValueIsAccountCollectionModelContainingAllAccounts() { IList <IAccount> accounts = _fixture.CreateMany <IAccount>(_random.Next(5, 10)).ToList(); IAccountCollection accountCollection = _fixture.BuildAccountCollectionMock(accountCollection: accounts).Object; Controller sut = CreateSut(accountCollection); OkObjectResult result = (OkObjectResult)(await sut.AccountsAsync(_fixture.Create <int>())).Result; AccountCollectionModel accountCollectionModel = (AccountCollectionModel)result.Value; Assert.That(accountCollectionModel, Is.Not.Null); Assert.That(accountCollectionModel.Count, Is.EqualTo(accounts.Count)); Assert.That(accountCollectionModel.All(accountModel => accounts.SingleOrDefault(account => string.CompareOrdinal(accountModel.AccountNumber, account.AccountNumber) == 0) != null), Is.True); }
public Accounting(int number, string name, ILetterHead letterHead, BalanceBelowZeroType balanceBelowZero, int backDating, IAccountCollection accountCollection, IBudgetAccountCollection budgetAccountCollection, IContactAccountCollection contactAccountCollection) { NullGuard.NotNullOrWhiteSpace(name, nameof(name)) .NotNull(letterHead, nameof(letterHead)) .NotNull(accountCollection, nameof(accountCollection)) .NotNull(budgetAccountCollection, nameof(budgetAccountCollection)) .NotNull(contactAccountCollection, nameof(contactAccountCollection)); Number = number; Name = name.Trim(); LetterHead = letterHead; BalanceBelowZero = balanceBelowZero; BackDating = backDating; AccountCollection = accountCollection; BudgetAccountCollection = budgetAccountCollection; ContactAccountCollection = contactAccountCollection; }
public BlockChain(LyraSystem sys) { if (Singleton != null) { throw new Exception("Blockchain reinitialization"); } _sys = sys; var nodeConfig = Neo.Settings.Default.LyraNode; _store = new MongoAccountCollection(); _log = new SimpleLogger("BlockChain").Logger; _nodeConfig = nodeConfig; NetworkID = nodeConfig.Lyra.NetworkId; Singleton = this; }
public async Task GroupByAccountGroupAsync_WhenCalled_AssertNumberWasCalledOnAccountGroupForEachAccountInAccountCollection() { IAccountCollection sut = CreateSut(); Mock <IAccountGroup>[] accountGroupMockCollection = { _fixture.BuildAccountGroupMock(), _fixture.BuildAccountGroupMock(), _fixture.BuildAccountGroupMock() }; sut.Add(CreateAccountCollection(accountGroupMockCollection.Select(accountGroupMock => accountGroupMock.Object).ToArray())); await sut.GroupByAccountGroupAsync(); foreach (Mock <IAccountGroup> accountGroupMock in accountGroupMockCollection) { accountGroupMock.Verify(m => m.Number, Times.AtLeastOnce); } }
public async Task CalculateAsync_WhenCalled_AssertPostingLineCollectionWasCalledOnEachAccountFromCalculatedAccountCollection() { IList <Mock <IAccount> > accountMockCollection = new List <Mock <IAccount> > { _fixture.BuildAccountMock(), _fixture.BuildAccountMock(), _fixture.BuildAccountMock(), _fixture.BuildAccountMock(), _fixture.BuildAccountMock(), _fixture.BuildAccountMock(), _fixture.BuildAccountMock() }; IAccountCollection calculatedAccountCollection = _fixture.BuildAccountCollectionMock(accountCollection: accountMockCollection.Select(m => m.Object).ToArray()).Object; IAccountCollection accountCollection = _fixture.BuildAccountCollectionMock(calculatedAccountCollection: calculatedAccountCollection).Object; ICalculable <IAccounting> sut = CreateSut(accountCollection); await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); foreach (Mock <IAccount> accountMock in accountMockCollection) { accountMock.Verify(m => m.PostingLineCollection, Times.Once); } }
public async Task CalculateAsync_WhenCalled_AssertApplyCalculationAsyncWasCalledOnEachPostingLineCollectionForEachAccountFromCalculatedAccountCollection() { IList <Mock <IPostingLineCollection> > postingLineCollectionMockCollection = new List <Mock <IPostingLineCollection> > { _fixture.BuildPostingLineCollectionMock(isEmpty: true), _fixture.BuildPostingLineCollectionMock(isEmpty: true), _fixture.BuildPostingLineCollectionMock(isEmpty: true), _fixture.BuildPostingLineCollectionMock(isEmpty: true), _fixture.BuildPostingLineCollectionMock(isEmpty: true), _fixture.BuildPostingLineCollectionMock(isEmpty: true), _fixture.BuildPostingLineCollectionMock(isEmpty: true) }; IAccountCollection calculatedAccountCollection = _fixture.BuildAccountCollectionMock(accountCollection: postingLineCollectionMockCollection.Select(m => _fixture.BuildAccountMock(postingLineCollection: m.Object).Object).ToArray()).Object; IAccountCollection accountCollection = _fixture.BuildAccountCollectionMock(calculatedAccountCollection: calculatedAccountCollection).Object; ICalculable <IAccounting> sut = CreateSut(accountCollection); await sut.CalculateAsync(DateTime.Now.AddDays(_random.Next(1, 365) * -1)); foreach (Mock <IPostingLineCollection> postingLineCollectionMock in postingLineCollectionMockCollection) { postingLineCollectionMock.Verify(m => m.ApplyCalculationAsync(It.Is <IAccounting>(value => value != null && value == sut)), Times.Once); } }
public PluginCurrentObjectContext(IPluginContext context, IAccountCollection accountCollection) { _context = context; _accountCollection = accountCollection; }
public JUnitTestRunImportLegacyProfileConvertor(IConvertorArgs args, IAccountCollection accountCollection) : base(args, accountCollection) { }
public LegacyRevisionsImporter(IConvertorArgs args, IAccountCollection accountCollection) : base(args, accountCollection) { }
public RouterChildTagsSource(IAccountCollection accountCollection, IMsmqTransport transport) { _accountCollection = accountCollection; _transport = transport; }
public DeleteUnusedQueuesCommand(IAccountCollection accountCollection, IMsmqTransport msmqTransport) { _accountCollection = accountCollection; _msmqTransport = msmqTransport; }
protected override void OnInit() { base.OnInit(); AccountCollection = ObjectFactory.GetInstance<IAccountCollection>(); }