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); } }
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); } }
// 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(); } }
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;
/// <summary> /// Constructor /// </summary> /// <param name="context">instance of <see cref="VisitingStolacDbContext"/></param> public ContactRepository(VisitingStolacDbContext context) => _context = context;
/// <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;
/// <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; }