Exemple #1
0
        private void SaveMeterType()
        {
            if (!string.IsNullOrWhiteSpace(TextBoxDescription.Text))
            {
                TMF.Reports.Model.MeterType meterType = new TMF.Reports.Model.MeterType()
                {
                    Description = TextBoxDescription.Text,
                    CreatedBy   = _currentUser.Id.ToString(),
                    DocDate     = DateTime.Now,
                    Show        = 1,
                    LockCount   = 0
                };

                var createMeterType = _meterType.Create(new SmartDB(), ref meterType);

                bool flag = createMeterType.Code == ErrorEnum.NoError;
                if (flag)
                {
                    MessageBox.Show("Meter Type Created");
                    ResetControls();
                    BindMeterTypeWithDataGrid();
                }
                else
                {
                    MessageBox.Show(createMeterType.Code.ToString());
                }
            }
            else
            {
                MessageBox.Show("No meter type to save or Contact Admin.");
            }
        }
        public void MeterType_INS_True()
        {
            //Arrange
            TMF.Reports.Model.MeterType meterType = new TMF.Reports.Model.MeterType()
            {
                Description = "B+",
                CreatedBy   = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                EditedBy    = "646f18f9-6425-4769-aa79-16ecdb7cf816",
                DocDate     = DateTime.Now,
                Show        = 1,
                LockCount   = 0
            };

            //Act
            var  createMeterType = _meterType.Create(new SmartDB(), ref meterType);
            bool flag            = createMeterType.Code == ErrorEnum.NoError;

            //Assert
            Assert.IsTrue(flag);
        }