Example #1
0
        public void ContructorTest()
        {
            Ruling model;

            try
            {
                // Test exception is thrown.
                model = new Ruling(null);
                Assert.Fail();
            }
            catch (ArgumentNullException ex)
            {
                Assert.AreEqual("item", ex.ParamName);
            }
            catch
            {
                Assert.Fail();
            }

            var dto = new RulingDto()
            {
                Date = "2016, 10, 2",
                Text = "testing"
            };

            model = new Ruling(dto);

            Assert.AreEqual(dto.Date, model.Date);
            Assert.AreEqual(dto.Text, model.Text);
        }
Example #2
0
        /// <summary>
        /// Maps a single <see cref="LegalityDto"/> to a <see cref="Ruling"/> model.
        /// </summary>
        /// <param name="item">The foreign name data transfer object to map.</param>
        private void MapRuling(RulingDto item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            Date = item.Date;
            Text = item.Text;
        }
Example #3
0
        public IRuling MapRuling(RulingDto rulingDto)
        {
            if (rulingDto == null)
            {
                throw new ArgumentNullException(nameof(rulingDto));
            }

            return(new Ruling
            {
                Date = rulingDto.Date,
                Text = rulingDto.Text,
            });
        }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ruling"/> class.
 /// </summary>
 /// <param name="item">The legality data transfer object to map.</param>
 public Ruling(RulingDto item)
 {
     MapRuling(item);
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ruling"/> class.
 /// </summary>
 /// <param name="item">The legality data transfer object to map.</param>
 public Ruling(RulingDto item)
 {
     this.MapRuling(item);
 }