Beispiel #1
0
        public void AssertThatConvertYearEntryBusinessObjectToEntityWorks()
        {
            // Arrange
            var yearEntryBo = new NomDeBebe.Application.UseCases.BabyNames.BabyName {
                BabyNameId = 1, Name = "Billy", Gender = "M"
            };

            // Act
            var result = BabyBusinessObjectToEntityMapper.ConvertFromBusinessObject(yearEntryBo);

            // Assert
            Assert.AreEqual(1, result.Id);
            Assert.AreEqual("Billy", result.Name);
            Assert.AreEqual("M", result.Gender);
            Assert.IsNotNull(result.YearEntries);
        }
Beispiel #2
0
        public void AssertThatBabyNameBusinessObjectMapsToEntity()
        {
            // Arrange
            var babyNameBo = GetBabyBusinessObject();

            babyNameBo.YearEntries.Add(new Application.UseCases.BabyNames.YearEntry {
                Year = 2015, NumberInYear = 2, RankInYear = 7
            });

            // Act
            var result = BabyBusinessObjectToEntityMapper.ConvertFromBusinessObject(babyNameBo);

            // Assert
            Assert.AreEqual("Seth", result.Name);
            Assert.AreEqual("M", result.Gender);
            Assert.AreEqual(1, result.Id);

            Assert.AreEqual(1, result.YearEntries.Count());
            Assert.AreEqual(2015, result.YearEntries.First().Year);
        }