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); }
/// <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; }
public IRuling MapRuling(RulingDto rulingDto) { if (rulingDto == null) { throw new ArgumentNullException(nameof(rulingDto)); } return(new Ruling { Date = rulingDto.Date, Text = rulingDto.Text, }); }
/// <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); }
/// <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); }