Ejemplo n.º 1
0
        public void ShouldHaveError_Validate_When_DateDetail_HasNoValue()
        {
            VBRealizationDocumentNonPOViewModel dto = new VBRealizationDocumentNonPOViewModel()
            {
                VBNonPOType = "Dengan Nomor VB",
                Currency    = new CurrencyViewModel()
                {
                    Id = 1
                },
                VBDocument = new VBRequestDocumentNonPODto()
                {
                    Id = 1
                },
                Items = new List <VBRealizationDocumentNonPOExpenditureItemViewModel>()
                {
                    new VBRealizationDocumentNonPOExpenditureItemViewModel()
                    {
                        DateDetail = null,
                    }
                },
                UnitCosts = new List <VBRealizationDocumentNonPOUnitCostViewModel>()
            };

            var result = dto.Validate(null);

            Assert.True(0 < result.Count());
        }
Ejemplo n.º 2
0
        public void ShouldHaveError_Validate_When_IncomeTaxBy_NotExist()
        {
            VBRealizationDocumentNonPOViewModel dto = new VBRealizationDocumentNonPOViewModel()
            {
                Date        = DateTimeOffset.Now,
                VBNonPOType = "Dengan Nomor VB",
                Currency    = new CurrencyViewModel()
                {
                    Id = 1
                },
                VBDocument = new VBRequestDocumentNonPODto()
                {
                    Id = 1
                },
                Items = new List <VBRealizationDocumentNonPOExpenditureItemViewModel>()
                {
                    new VBRealizationDocumentNonPOExpenditureItemViewModel()
                    {
                        IsGetPPh  = true,
                        IncomeTax = new IncomeTaxViewModel()
                        {
                            Id = 1
                        },
                        DateDetail = DateTimeOffset.Now,
                    }
                },
                UnitCosts = new List <VBRealizationDocumentNonPOUnitCostViewModel>()
            };

            var result = dto.Validate(null);

            Assert.True(0 < result.Count());
        }
Ejemplo n.º 3
0
        public void ShouldHaveNoError_Validate_Data()
        {
            VBRealizationDocumentNonPOViewModel dto = new VBRealizationDocumentNonPOViewModel()
            {
                Date        = DateTimeOffset.Now,
                VBNonPOType = "Dengan Nomor VB",
                Currency    = new CurrencyViewModel()
                {
                    Id = 1
                },

                Unit = new UnitViewModel()
                {
                    Id   = 1,
                    Code = "Code",
                },
                VBDocument = new VBRequestDocumentNonPODto()
                {
                    Id = 1
                },
                Items = new List <VBRealizationDocumentNonPOExpenditureItemViewModel>()
                {
                    new VBRealizationDocumentNonPOExpenditureItemViewModel()
                    {
                        Amount    = 1,
                        Remark    = "Remark",
                        Total     = 1,
                        IsGetPPh  = true,
                        IncomeTax = new IncomeTaxViewModel()
                        {
                            Id = 1
                        },
                        DateDetail  = DateTimeOffset.Now.AddDays(-2),
                        IncomeTaxBy = "Supplier"
                    }
                },
                UnitCosts = new List <VBRealizationDocumentNonPOUnitCostViewModel>()
                {
                    new VBRealizationDocumentNonPOUnitCostViewModel()
                    {
                        Amount     = 1,
                        IsSelected = true,
                        Unit       = new UnitViewModel()
                        {
                            Id = 1,
                        }
                    }
                }
            };

            var result = dto.Validate(null);

            Assert.True(0 == result.Count());
        }
Ejemplo n.º 4
0
        public void ShouldHaveError_Validate_When_Data_Null()
        {
            VBRealizationDocumentNonPOViewModel dto = new VBRealizationDocumentNonPOViewModel()
            {
                Items     = new List <VBRealizationDocumentNonPOExpenditureItemViewModel>(),
                UnitCosts = new List <VBRealizationDocumentNonPOUnitCostViewModel>()
            };

            var result = dto.Validate(null);

            Assert.True(0 < result.Count());
        }
Ejemplo n.º 5
0
        public void ShouldHaveError_Validate_When_CurrencyId_Equal_Zero()
        {
            VBRealizationDocumentNonPOViewModel dto = new VBRealizationDocumentNonPOViewModel()
            {
                Currency = new CurrencyViewModel()
                {
                    Id = 0
                },
                Items     = new List <VBRealizationDocumentNonPOExpenditureItemViewModel>(),
                UnitCosts = new List <VBRealizationDocumentNonPOUnitCostViewModel>()
            };

            var result = dto.Validate(null);

            Assert.True(0 < result.Count());
        }