public void TestMethod00002()
        {
            var moq = new Mock <ISimpleRepo <FundRequestDTO> >();
            var sut = new FundRequestsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.BankAccountId = 0;
            sut.IsValidForInsert(obj, out string why).Should().BeFalse();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeFalse();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();

            obj.BankAccountId = 123;
            obj.Id            = 0;
            sut.IsValidForInsert(obj, out why).Should().BeTrue();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeTrue();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();

            obj.BankAccountId = -456;
            obj.Id            = 0;
            sut.IsValidForInsert(obj, out why).Should().BeFalse();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeFalse();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();
        }
Beispiel #2
0
        public PassbookDBFile(ITenantDBsDir dir)
        {
            _pbkDbPath = GetDbPath(dir.MarketState);
            var pbkDb    = new SharedLiteDB(_pbkDbPath, dir.MarketState.CurrentUser);
            var inactvDb = InactivesLocalDir.GetRequestsDB(dir);

            ActiveRequests = new FundRequestsRepo1(new ActiveRequestsCollection(pbkDb));
            //InactiveRequests_old = new FundRequestsRepo1(new InactiveRequestsCollection(pbkDb));
            InactiveRequests = new FundRequestsRepo1(new InactiveRequestsCollection(inactvDb));
            PreparedCheques  = new PreparedChequesRepo1(new ChequeVouchersCollection(pbkDb));
            PassbookRows     = dir.Passbooks;
        }
        public void TestMethod00004()
        {
            var moq = new Mock <ISimpleRepo <FundRequestDTO> >();
            var sut = new FundRequestsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Purpose = null;
            sut.IsValidForInsert(obj, out string why).Should().BeFalse();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeFalse();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();

            obj.Purpose = "reason";
            obj.Id      = 0;
            sut.IsValidForInsert(obj, out why).Should().BeTrue();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeTrue();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();
        }
        public void TestMethod00007()
        {
            var moq = new Mock <ISimpleRepo <FundRequestDTO> >();
            var sut = new FundRequestsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Allocations[1].SubAmount = -788;
            sut.IsValidForInsert(obj, out string why).Should().BeFalse();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeFalse();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();

            obj.Allocations[1].SubAmount = -789;
            obj.Id = 0;
            sut.IsValidForInsert(obj, out why).Should().BeTrue();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeTrue();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();
        }
        public void TestMethod00005()
        {
            var moq = new Mock <ISimpleRepo <FundRequestDTO> >();
            var sut = new FundRequestsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.DateOffset = 0;
            sut.IsValidForInsert(obj, out string why).Should().BeFalse();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeFalse();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();

            obj.DateOffset = DateTime.Now.DaysSinceMin();
            obj.Id         = 0;
            sut.IsValidForInsert(obj, out why).Should().BeTrue();
            obj.Id = 123;
            sut.IsValidForUpdate(obj, out why).Should().BeTrue();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();
        }