public void Should_Success_Instantiate()
        {
            var time    = DateTimeOffset.Now;
            var details = new List <MonitoringSpecificationMachineDetailsViewModel>()
            {
                new MonitoringSpecificationMachineDetailsViewModel()
            };
            var machine         = new MachineViewModel();
            var productionOrder = new ProductionOrderIntegrationViewModel();
            MonitoringSpecificationMachineViewModel viewModel = new MonitoringSpecificationMachineViewModel()
            {
                UId             = "UId",
                Code            = "Code",
                CartNumber      = "CartNumber",
                DateTimeInput   = time,
                Machine         = machine,
                Details         = details,
                ProductionOrder = productionOrder,
            };

            Assert.Equal("UId", viewModel.UId);
            Assert.Equal("Code", viewModel.Code);
            Assert.Equal("CartNumber", viewModel.CartNumber);
            Assert.Equal(machine, viewModel.Machine);
            Assert.Equal(details, viewModel.Details);
            Assert.Equal(time, viewModel.DateTimeInput);
            Assert.Equal(productionOrder, viewModel.ProductionOrder);
        }
        public void validate_default()
        {
            MonitoringSpecificationMachineViewModel viewModel = new MonitoringSpecificationMachineViewModel();

            var result = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
        public void validate_DetailsCount_Empty()
        {
            MonitoringSpecificationMachineViewModel viewModel = new MonitoringSpecificationMachineViewModel()
            {
                Details = new List <MonitoringSpecificationMachineDetailsViewModel>()
                {
                },
            };
            var result = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
Exemple #4
0
        public void Mapping_With_AutoMapper_Profiles()
        {
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <MonitoringSpecificationMachineProfile>();
            });
            var mapper = configuration.CreateMapper();

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

            Assert.Equal(vm.Id, model.Id);
        }
        public void validate_Details_when_DataType_input_teks()
        {
            MonitoringSpecificationMachineViewModel viewModel = new MonitoringSpecificationMachineViewModel()
            {
                Details = new List <MonitoringSpecificationMachineDetailsViewModel>()
                {
                    new MonitoringSpecificationMachineDetailsViewModel()
                    {
                        DataType     = "input teks",
                        Value        = "",
                        DefaultValue = "1-4"
                    }
                },
            };
            var result = viewModel.Validate(null);

            Assert.True(0 < result.Count());
        }
        public void validate_Details_when_DataType_skala_angka()
        {
            MonitoringSpecificationMachineViewModel viewModel = new MonitoringSpecificationMachineViewModel()
            {
                Details = new List <MonitoringSpecificationMachineDetailsViewModel>()
                {
                    new MonitoringSpecificationMachineDetailsViewModel()
                    {
                        DataType     = "input skala angka",
                        Value        = "4",
                        DefaultValue = "4-1"
                    }
                },
            };
            var result = viewModel.Validate(null);

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