Ejemplo n.º 1
0
        public void frompage_shouldfillcorrectproperties()
        {
            // Arrange
            Page page = new Page();

            page.Id         = 123;
            page.CreatedBy  = "createdby";
            page.CreatedOn  = DateTime.UtcNow;
            page.IsLocked   = true;
            page.ModifiedBy = "modifiedby";
            page.ModifiedOn = DateTime.UtcNow;
            page.Tags       = "tag1,tag2";
            page.Title      = "title";

            PageEntity entity = new PageEntity();

            // Act
            ToEntity.FromPage(page, entity);

            // Assert
            Assert.That(entity.Id, Is.Not.EqualTo(page.Id));             // the id isn't copied from the page
            Assert.That(entity.CreatedBy, Is.EqualTo(page.CreatedBy));
            Assert.That(entity.CreatedOn, Is.EqualTo(page.CreatedOn));
            Assert.That(entity.IsLocked, Is.EqualTo(page.IsLocked));
            Assert.That(entity.ModifiedBy, Is.EqualTo(page.ModifiedBy));
            Assert.That(entity.ModifiedOn, Is.EqualTo(page.ModifiedOn));
            Assert.That(entity.Tags, Is.EqualTo(page.Tags));
            Assert.That(entity.Title, Is.EqualTo(page.Title));
        }