Esempio n. 1
0
        public ColorModel Save(ColorModel color)
        {
            //  validasi
            var result = color;

            result = TryValidate(color);

            //  save
            var dummyColor = _colorDal.GetData(color.ColorID);

            if (dummyColor == null)
            {
                _colorDal.Insert(result);
            }
            else
            {
                _colorDal.Update(result);
            }

            return(result);
        }
Esempio n. 2
0
        public void GetData_ValidData_NoEx()
        {
            using (var trans = TransHelper.NewScope())
            {
                //  arrange
                var expected = ColorDataFactory();
                _colorDal.Insert(expected);

                //  act
                var actual = _colorDal.GetData("A1");

                //  assert
                actual.Should().BeEquivalentTo(expected);
            }
        }