Beispiel #1
0
        public void ContructorTest()
        {
            Legality model;

            try
            {
                // Test exception is thrown.
                model = new Legality(null);
                Assert.True(false);
            }
            catch (ArgumentNullException ex)
            {
                Assert.Equal("item", ex.ParamName);
            }
            catch
            {
                Assert.True(false);
            }

            var dto = new LegalityDto()
            {
                Format       = "format1",
                LegalityName = "fake name"
            };

            model = new Legality(dto);

            Assert.Equal(dto.Format, model.Format);
            Assert.Equal(dto.LegalityName, model.LegalityName);
        }
Beispiel #2
0
        /// <summary>
        /// Maps a single <see cref="LegalityDto"/> to a <see cref="Legality"/> model.
        /// </summary>
        /// <param name="item">The foreign name data transfer object to map.</param>
        private void MapLegality(LegalityDto item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            Format       = item.Format;
            LegalityName = item.LegalityName;
        }
Beispiel #3
0
        public ILegality MapLegality(LegalityDto legalityDto)
        {
            if (legalityDto == null)
            {
                throw new ArgumentNullException(nameof(legalityDto));
            }

            return(new Legality
            {
                Format = legalityDto.Format,
                LegalityName = legalityDto.LegalityName,
            });
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Legality"/> class.
 /// </summary>
 /// <param name="item">The legality data transfer object to map.</param>
 public Legality(LegalityDto item)
 {
     MapLegality(item);
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Legality"/> class.
 /// </summary>
 /// <param name="item">The legality data transfer object to map.</param>
 public Legality(LegalityDto item)
 {
     this.MapLegality(item);
 }