コード例 #1
0
        public void Rejectzeroamount()
        {
            var moq = new Mock <ISimpleRepo <AmbulantColxnDTO> >();
            var sut = new AmbulantColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Amount = 0;
            obj.Id     = 0;
            sut.IsValidForInsert(obj, out string why).Should().BeFalse();
            obj.Id = 101;
            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 = 101;
            sut.IsValidForUpdate(obj, out why).Should().BeTrue();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();

            obj.Amount = -456;
            sut.IsValidForInsert(obj, out why).Should().BeFalse();
            sut.IsValidForUpdate(obj, out why).Should().BeFalse();
            sut.IsValidForDelete(obj, out why).Should().BeTrue();
        }
コード例 #2
0
        public void RejectsnullBankAccount()
        {
            var moq = new Mock <ISimpleRepo <AmbulantColxnDTO> >();
            var sut = new AmbulantColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.ReceivedFrom = "";
            obj.Id           = 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.ReceivedFrom = "Someone";
            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 Rejectsblankdepositslip()
        {
            var moq = new Mock <ISimpleRepo <AmbulantColxnDTO> >();
            var sut = new AmbulantColxnsRepo1(moq.Object);
            var obj = ValidSampleDTO();

            obj.PRNumber = null;
            obj.Id       = 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 = 456;
            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();
        }