Пример #1
0
        public void CreateTranslationFail()
        {
            //Arrange
            var pageContentRepository = new PageContentRepository(_container);
            var dbContext             = _serviceProvider.GetRequiredService <DeviserDbContext>();
            var pageContents          = TestDataRepository.GetPageContents();
            PageContentTranslation pageContentTranslation = null;


            //Act
            var result = pageContentRepository.CreateTranslation(pageContentTranslation);

            //Assert
            Assert.Null(result);

            //Clean
            dbContext.PageContentTranslation.RemoveRange(dbContext.PageContentTranslation);
        }
Пример #2
0
        public void CreateTranslationSuccess()
        {
            //Arrange
            var pageContentRepository  = new PageContentRepository(_container);
            var dbContext              = _serviceProvider.GetRequiredService <DeviserDbContext>();
            var pageContents           = TestDataRepository.GetPageContents();
            var pageContentTranslation = pageContents.First().PageContentTranslation.First();


            //Act
            var result = pageContentRepository.CreateTranslation(pageContentTranslation);

            //Assert
            Assert.NotNull(result);
            Assert.NotEqual(result.Id, Guid.Empty);
            Assert.True(!string.IsNullOrEmpty(result.ContentData));
            Assert.True(!string.IsNullOrEmpty(result.CultureCode));
            Assert.True(result.CreatedDate > DateTime.MinValue);
            Assert.True(result.LastModifiedDate > DateTime.MinValue);

            //Clean
            dbContext.PageContentTranslation.RemoveRange(dbContext.PageContentTranslation);
        }