예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }