Ejemplo n.º 1
0
        public void TestMethod00001()
        {
            var moq = new Mock <ISimpleRepo <JournalVoucherDTO> >();
            var sut = new JournalSoloShard1(moq.Object);
            var obj = ValidSampleDTO();

            obj.SerialNum = 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.SerialNum = 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.SerialNum = -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();
        }
Ejemplo n.º 2
0
        public void TestMethod00005()
        {
            var moq = new Mock <ISimpleRepo <JournalVoucherDTO> >();
            var sut = new JournalSoloShard1(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();
        }
Ejemplo n.º 3
0
        public void TestMethod00003()
        {
            var moq = new Mock <ISimpleRepo <JournalVoucherDTO> >();
            var sut = new JournalSoloShard1(moq.Object);
            var obj = ValidSampleDTO();

            obj.Description = 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.Description = "some desc";
            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();
        }
Ejemplo n.º 4
0
        public void TestMethod00007()
        {
            var moq = new Mock <ISimpleRepo <JournalVoucherDTO> >();
            var sut = new JournalSoloShard1(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();
        }