public void Validate_Data_Details_CostCalculation_Empty()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId  = 1,
                DONo  = "DONo",
                Items = new List <GarmentPOMasterDistributionItemViewModel>
                {
                    new GarmentPOMasterDistributionItemViewModel
                    {
                        Details = new List <GarmentPOMasterDistributionDetailViewModel>
                        {
                            new GarmentPOMasterDistributionDetailViewModel
                            {
                                CostCalculationId = 0,
                                RONo = null
                            }
                        }
                    }
                }
            };

            Assert.True(viewModel.Validate(GetValidationContext(viewModel)).Count() > 0);
        }
        public void Validate_Data_Items_TotalQuantity_Too_Much()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId  = 1,
                DONo  = "DONo",
                Items = new List <GarmentPOMasterDistributionItemViewModel>
                {
                    new GarmentPOMasterDistributionItemViewModel
                    {
                        Details = new List <GarmentPOMasterDistributionDetailViewModel>
                        {
                            new GarmentPOMasterDistributionDetailViewModel
                            {
                                CostCalculationId = 1,
                                RONo           = "RONo",
                                POSerialNumber = "POSerialNumber",
                                QuantityCC     = 2,
                                Conversion     = 2,
                                Quantity       = 4
                            }
                        },
                        DOQuantity = 2
                    }
                }
            };

            Assert.True(viewModel.Validate(GetValidationContext(viewModel)).Count() > 0);
        }
        public void Validate_Data_Details_QuantityCC_Used_All()
        {
            var othersQuantity = new KeyValuePair <string, decimal>("POSerialNumber", 2);

            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId  = 1,
                DONo  = "DONo",
                Items = new List <GarmentPOMasterDistributionItemViewModel>
                {
                    new GarmentPOMasterDistributionItemViewModel
                    {
                        Details = new List <GarmentPOMasterDistributionDetailViewModel>
                        {
                            new GarmentPOMasterDistributionDetailViewModel
                            {
                                CostCalculationId = 1,
                                RONo           = "RONo",
                                POSerialNumber = othersQuantity.Key,
                                QuantityCC     = othersQuantity.Value,
                                Conversion     = 1,
                                Quantity       = 1
                            }
                        }
                    }
                }
            };

            Assert.True(viewModel.Validate(GetValidationContext(viewModel, new Dictionary <string, decimal> {
                { othersQuantity.Key, othersQuantity.Value }
            })).Count() > 0);
        }
        public void Validate_Data_Details_Conversion_Null()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId  = 1,
                DONo  = "DONo",
                Items = new List <GarmentPOMasterDistributionItemViewModel>
                {
                    new GarmentPOMasterDistributionItemViewModel
                    {
                        Details = new List <GarmentPOMasterDistributionDetailViewModel>
                        {
                            new GarmentPOMasterDistributionDetailViewModel
                            {
                                CostCalculationId = 1,
                                RONo           = "RONo",
                                POSerialNumber = "POSerialNumber",
                                Conversion     = 0
                            }
                        }
                    }
                }
            };

            Assert.True(viewModel.Validate(GetValidationContext(viewModel)).Count() > 0);
        }
        public void Validate_Data_Supplier_Null()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = null
            };

            Assert.True(viewModel.Validate(null).Count() > 0);
        }
        public void Validate_Data_DO_Invalid()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId = 0,
                DONo = null
            };

            Assert.True(viewModel.Validate(null).Count() > 0);
        }
        public void Validate_Data_Items_Null()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId  = 1,
                DONo  = "DONo",
                Items = null
            };

            Assert.True(viewModel.Validate(null).Count() > 0);
        }
        public void Validate_Data_Details_Empty()
        {
            GarmentPOMasterDistributionViewModel viewModel = new GarmentPOMasterDistributionViewModel
            {
                Supplier = new SupplierViewModel {
                    Id = 1
                },
                DOId  = 1,
                DONo  = "DONo",
                Items = new List <GarmentPOMasterDistributionItemViewModel>
                {
                    new GarmentPOMasterDistributionItemViewModel
                    {
                        Details = null
                    }
                }
            };

            Assert.True(viewModel.Validate(null).Count() > 0);
        }