Added unit tests for API and Web App

Also updated backend to use .NET6
This commit is contained in:
2023-03-06 21:59:17 -06:00
parent efb22aa0af
commit 771b63f6c4
14 changed files with 971 additions and 262 deletions

View File

@ -12,6 +12,7 @@ namespace YABA.Data.Context
{
public class YABABaseContext : DbContext
{
public YABABaseContext() : base() { }
public YABABaseContext(DbContextOptions<YABABaseContext> options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
@ -47,10 +48,10 @@ namespace YABA.Data.Context
.IsUnique();
}
public DbSet<Bookmark> Bookmarks { get; set; }
public DbSet<Tag> Tags { get; set; }
public DbSet<BookmarkTag> BookmarkTags { get; set; }
public DbSet<User> Users { get; set; }
public virtual DbSet<Bookmark> Bookmarks { get; set; }
public virtual DbSet<Tag> Tags { get; set; }
public virtual DbSet<BookmarkTag> BookmarkTags { get; set; }
public virtual DbSet<User> Users { get; set; }
private static LambdaExpression ConvertFilterExpression<TInterface>(
Expression<Func<TInterface, bool>> filterExpression,

View File

@ -4,6 +4,7 @@ namespace YABA.Data.Context
{
public class YABAReadOnlyContext : YABABaseContext
{
public YABAReadOnlyContext() : base() { }
public YABAReadOnlyContext(DbContextOptions<YABABaseContext> options) : base(options)
{
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

View File

@ -9,6 +9,8 @@ namespace YABA.Data.Context
{
public class YABAReadWriteContext : YABABaseContext
{
public YABAReadWriteContext() : base() { }
public YABAReadWriteContext(DbContextOptions<YABABaseContext> options) : base(options)
{
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;

View File

@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EFCore.NamingConventions" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.17">
<PackageReference Include="EFCore.NamingConventions" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.8" />
</ItemGroup>
<ItemGroup>