コード例 #1
0
        public void validate_when_MaterialConstruction_Empty()
        {
            ReturToQCViewModel viewModel = new ReturToQCViewModel()
            {
                MaterialConstruction = new MaterialConstructionIntegrationViewModel()
                {
                    Id = 0
                },
                Items = new List <ReturToQCItemViewModel>()
                {
                    new ReturToQCItemViewModel()
                    {
                        Details = new List <ReturToQCItemDetailViewModel>()
                        {
                            new ReturToQCItemDetailViewModel()
                            {
                                ReturQuantity  = 3,
                                QuantityBefore = 1
                            }
                        }
                    }
                }
            };
            var result = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
コード例 #2
0
        public void validate_when_QuantityBefore_moreThan_1()
        {
            ReturToQCViewModel viewModel = new ReturToQCViewModel()
            {
                Items = new List <ReturToQCItemViewModel>()
                {
                    new ReturToQCItemViewModel()
                    {
                        ProductionOrder = new ProductionOrderIntegrationViewModel()
                        {
                            Id = 0
                        },

                        Details = new List <ReturToQCItemDetailViewModel>()
                        {
                            new ReturToQCItemDetailViewModel()
                            {
                                QuantityBefore = 1
                            }
                        }
                    }
                }
            };
            var result = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
コード例 #3
0
        public void validate_when_ProductionOrderNo_Empty()
        {
            ReturToQCViewModel viewModel = new ReturToQCViewModel()
            {
                Items = new List <ReturToQCItemViewModel>()
                {
                    new ReturToQCItemViewModel()
                    {
                        ProductionOrder = new ProductionOrderIntegrationViewModel()
                        {
                            Id = 0
                        },

                        Details = new List <ReturToQCItemDetailViewModel>()
                        {
                            //new ReturToQCItemDetailViewModel()
                            //{
                            //    ReturQuantity =0,
                            //    QuantityBefore =1
                            //}
                        }
                    }
                }
            };
            var result = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
コード例 #4
0
        public void Should_Success_Instantiate()
        {
            ReturToQCViewModel viewModel = new ReturToQCViewModel()
            {
                UId = "UId"
            };

            Assert.Equal("UId", viewModel.UId);
        }
        public void Mapping_With_AutoMapper_Profiles()
        {
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <ReturToQCProfile>();
            });
            var mapper = configuration.CreateMapper();

            ReturToQCViewModel vm = new ReturToQCViewModel {
                Id = 1
            };
            ReturToQCModel model = mapper.Map <ReturToQCModel>(vm);

            Assert.Equal(vm.Id, model.Id);
        }
コード例 #6
0
        public void validate_default()
        {
            ReturToQCViewModel viewModel = new ReturToQCViewModel()
            {
                Items = new List <ReturToQCItemViewModel>()
                {
                    new ReturToQCItemViewModel()
                    {
                        Details = new List <ReturToQCItemDetailViewModel>()
                        {
                            new ReturToQCItemDetailViewModel()
                            {
                                ReturQuantity = 0
                            }
                        }
                    }
                }
            };
            var result = viewModel.Validate(null);

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