private StatementViewModel Arrange() { StatementViewModel subject = CreateSubject().Initialise(this.mockTransactionService.Object); subject.Statement = StatementModelTestData.TestData1(); return(subject); }
public void SetStatement_ShouldThrow_GivenInitialiseHasNotBeenCalled() { StatementViewModel subject = CreateSubject(); subject.Statement = StatementModelTestData.TestData1(); Assert.Fail(); }
public void Match_ShouldRemoveSingleUseRulesThatWereUsed() { IEnumerable <Transaction> testTransactions = StatementModelTestData.TestData1().Transactions; var testMatchingRules = new List <MatchingRule> { new SingleUseMatchingRule(this.mockBucketRepo) { Amount = -95.15M, And = true, BucketCode = StatementModelTestData.PhoneBucket.Code, Reference1 = "skjghjkh", MatchCount = 1 // Artificially set to simulate a match }, new MatchingRule(this.mockBucketRepo) { Amount = -11.11M, BucketCode = StatementModelTestData.CarMtcBucket.Code } }; this.mockMatchMaker.Setup(m => m.Match(testTransactions, testMatchingRules)).Returns(true); this.mockBucketRepo.GetOrCreateNew(TestDataConstants.PowerBucketCode, () => new SpentMonthlyExpenseBucket(TestDataConstants.PowerBucketCode, "Foo")); this.mockBucketRepo.GetOrCreateNew(TestDataConstants.PhoneBucketCode, () => new SpentMonthlyExpenseBucket(TestDataConstants.PhoneBucketCode, "Foo")); PrivateAccessor.InvokeMethod(this.subject, "InitialiseTheRulesCollections", testMatchingRules); PrivateAccessor.SetField <TransactionRuleService>(this.subject, "rulesStorageKey", "lksjgjklshgjkls"); var success = this.subject.Match(testTransactions); Assert.IsTrue(success); Assert.IsFalse(this.subject.MatchingRules.Any(r => r is SingleUseMatchingRule)); }
public void PerformanceOfValidateTest() { StatementModel subject = StatementModelTestData.TestData1(); Stopwatch stopwatch = Stopwatch.StartNew(); subject.ValidateAgainstDuplicates(); stopwatch.Stop(); Console.WriteLine("{0:N0} ms", stopwatch.ElapsedMilliseconds); Assert.IsTrue(stopwatch.ElapsedMilliseconds < 250); }
public void TestInitialise() { this.testDataBudget = BudgetModelTestData.CreateTestData1(); this.testDataStatement = StatementModelTestData.TestData1(); this.subject = LedgerBookTestData.TestData1(); }
public void CalculateOverSpentLedgersShouldThrowGivenNullLedger() { Subject.CalculateOverspentLedgers(StatementModelTestData.TestData1(), null, new DateTime(2014, 07, 01)); Assert.Fail(); }
public void CalculateOverSpentLedgersShouldReturnEmptyGivenNoLedgerLineForGivenDate() { IEnumerable <ReportTransaction> result = Subject.CalculateOverspentLedgers(StatementModelTestData.TestData1(), TestData, new DateTime(2014, 07, 01)); Assert.IsTrue(result.Count() == 0); }
private TransactionGroupedByBucket Arrange() { StatementModel statementModel = StatementModelTestData.TestData1(); return(new TransactionGroupedByBucket(statementModel.AllTransactions, StatementModelTestData.PowerBucket)); }