Beispiel #1
0
        public void Rejectsblankdepositslip()
        {
            var moq = new Mock <ISimpleRepo <IntendedColxnDTO> >();
            var sut = new IntendedColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.PRNumber = 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.PRNumber = 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.PRNumber = -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 void Rejectzeroamount()
        {
            var moq = new Mock <ISimpleRepo <IntendedColxnDTO> >();
            var sut = new IntendedColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Actuals.Rent = 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.Actuals.Rent = 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.Actuals.Rent = -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();
        }
 private void SetIntendedColxns(Dictionary <int, IIntendedColxnsRepo> dict, SharedLiteDB db)
 {
     foreach (var sec in _mkt.Sections.GetAll())
     {
         var colxn = new IntendedColxnsCollection(sec, db);
         var repo  = new IntendedColxnsRepo1(colxn);
         dict.Add(sec.Id, repo);
     }
 }
Beispiel #4
0
        public void RejectsnullStall()
        {
            var moq = new Mock <ISimpleRepo <IntendedColxnDTO> >();
            var sut = new IntendedColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Lease.Stall = 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.Stall = ValidSampleStall();
            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();
        }