Пример #1
0
        public void Should_GetFilteredPledgesSummary()
        {
            using (var db = CMSDataContext.Create(DatabaseFixture.Host))
            {
                var fromDate     = new DateTime(2019, 1, 1);
                var person       = MockPeople.CreateSavePerson(db);
                var bundleHeader = MockContributions.CreateSaveBundle(db);
                var pledge       = MockContributions.CreateSaveContribution(
                    db, bundleHeader, fromDate, 200, peopleId: person.PeopleId, fundId: 1, contributionType: ContributionTypeCode.Pledge);
                var firstContribution  = MockContributions.CreateSaveContribution(db, bundleHeader, fromDate, 100, peopleId: person.PeopleId, fundId: 1, contributionType: ContributionTypeCode.CheckCash);
                var secondContribution = MockContributions.CreateSaveContribution(db, bundleHeader, fromDate, 100, peopleId: person.PeopleId, fundId: 2, contributionType: ContributionTypeCode.CheckCash);
                var setting            = MockSettings.CreateSaveSetting(db, "PostContributionPledgeFunds", "1");
                var expected           = MockContributions.FilteredPledgesSummary();

                var actual = PledgesHelper.GetFilteredPledgesSummary(db, person.PeopleId);
                actual.Should().BeEquivalentTo(expected);

                MockContributions.DeleteAllFromBundle(db, bundleHeader);
            }
        }