Exemple #1
0
        public void GetByIdAsync_ShouldReturnPost()
        {
            using (var context = new VisitingStolacDbContext(_options))
            {
                var service = new PostRepository(context);

                var x = service.GetByIdAsync(1, Locale.BOS).GetAwaiter().GetResult();
                Assert.IsTrue(x != null);
            }
        }
Exemple #2
0
        public void GetAllAsync_Default_ShouldReturnList()
        {
            using (var context = new VisitingStolacDbContext(_options))
            {
                var service = new PostRepository(context);
                PostPagingParametersDto dto = new PostPagingParametersDto
                {
                    Locale     = Locale.BOS,
                    PageNumber = 1,
                    PageSize   = 10
                };

                var x = service.GetAllAsync(dto).GetAwaiter().GetResult();
                Assert.IsTrue(x != null);
            }
        }
Exemple #3
0
        // test not working properly yet
        public void GenerateData()
        {
            Post post = new Post()
            {
                Id       = 1,
                Created  = DateTime.Now,
                Modified = DateTime.Now,
                Type     = PostType.Activity
            };

            using (var context = new VisitingStolacDbContext(_options))
            {
                context.Posts.Add(post);
                context.SaveChanges();
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .AddJsonFile("appSettings.json", optional: false, reloadOnChange: true)
                                            .AddJsonFile("appSettings.development.json", optional: false, reloadOnChange: true);

            var factory = new VisitingStolacDbContextFactory();

            using (VisitingStolacDbContext context = factory.CreateDbContext(args))
            {
                Console.WriteLine("Starting migrations...");
                context.Database.Migrate();
            }

            Console.WriteLine("Completed ...");
            Console.ReadLine();
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">instance of <see cref="VisitingStolacDbContext"/></param>
 public ContributionRepository(VisitingStolacDbContext context) => _context = context;
Exemple #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">instance of <see cref="VisitingStolacDbContext"/></param>
 public ContactRepository(VisitingStolacDbContext context) => _context = context;
Exemple #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">instance of <see cref="VisitingStolacDbContext"/></param>
 public AdministratorRepository(VisitingStolacDbContext context) => _context = context;
 public TextContentTranslationRepository(VisitingStolacDbContext context)
 {
     _context = context;
 }
 /// <summary>
 /// unit of work constructor
 /// </summary>
 /// <param name="dbContext">instance of <see cref="VisitingStolacDbContext"/></param>
 public UnitOfWork(VisitingStolacDbContext dbContext) => _dbContext = dbContext;
Exemple #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">instance of <see cref="VisitingStolacDbContext"/></param>
 public SubscriberRepository(VisitingStolacDbContext context) => _context = context;
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context">instance of <see cref="VisitingStolacDbContext"/></param>
 public MediaRepository(VisitingStolacDbContext context)
 {
     _context = context;
 }