示例#1
0
        public void Rejectzeroamount()
        {
            var moq = new Mock <ISimpleRepo <CashierColxnDTO> >();
            var sut = new CashierColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Amount = 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.Amount = 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.Amount = -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();
        }
示例#2
0
        public void Rejectsblankdepositslip()
        {
            var moq = new Mock <ISimpleRepo <CashierColxnDTO> >();
            var sut = new CashierColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.DocumentRef = "";
            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.DocumentRef = "efg";
            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();
        }
示例#3
0
        public void RejectsinvalidBillCode()
        {
            var moq = new Mock <ISimpleRepo <CashierColxnDTO> >();
            var sut = new CashierColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.BillCode = 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.BillCode = BillCode.Other;
            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();
        }
示例#4
0
        public void RejectsnullBankAccount()
        {
            var moq = new Mock <ISimpleRepo <CashierColxnDTO> >();
            var sut = new CashierColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Lease = 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.Lease = new LeaseDTO {
                Id = 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();
        }