Skip to content

Commit

Permalink
Converting Inheritance relationship tests to AssertQuery infra
Browse files Browse the repository at this point in the history
  • Loading branch information
maumar committed Jul 8, 2020
1 parent 45fe7cd commit 69a3cad
Show file tree
Hide file tree
Showing 31 changed files with 2,036 additions and 1,261 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships;
using Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel;

namespace Microsoft.EntityFrameworkCore.Query
{
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class BaseCollectionOnBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class BaseCollectionOnDerived
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class BaseInheritanceRelationshipEntity
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class BaseReferenceOnBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class BaseReferenceOnDerived
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class CollectionOnBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class CollectionOnDerived
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class DerivedCollectionOnBase : BaseCollectionOnBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class DerivedCollectionOnDerived : BaseCollectionOnDerived
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class DerivedInheritanceRelationshipEntity : BaseInheritanceRelationshipEntity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class DerivedReferenceOnBase : BaseReferenceOnBase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationships
namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class DerivedReferenceOnDerived : BaseReferenceOnDerived
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.EntityFrameworkCore.TestUtilities;

namespace Microsoft.EntityFrameworkCore.TestModels.InheritanceRelationshipsModel
{
public class InheritanceRelationshipsContext : PoolableDbContext
{
public static readonly string StoreName = "InheritanceRelationships";

public InheritanceRelationshipsContext(DbContextOptions options)
: base(options)
{
}

public DbSet<BaseCollectionOnBase> BaseCollectionsOnBase { get; set; }
public DbSet<BaseCollectionOnDerived> BaseCollectionsOnDerived { get; set; }
public DbSet<BaseInheritanceRelationshipEntity> BaseEntities { get; set; }
public DbSet<BaseReferenceOnBase> BaseReferencesOnBase { get; set; }
public DbSet<BaseReferenceOnDerived> BaseReferencesOnDerived { get; set; }
public DbSet<CollectionOnBase> CollectionsOnBase { get; set; }
public DbSet<CollectionOnDerived> CollectionsOnDerived { get; set; }
public DbSet<NestedCollectionBase> NestedCollections { get; set; }
public DbSet<NestedReferenceBase> NestedReferences { get; set; }
public DbSet<PrincipalEntity> PrincipalEntities { get; set; }
public DbSet<ReferencedEntity> ReferencedEntities { get; set; }
public DbSet<ReferenceOnBase> ReferencesOnBase { get; set; }
public DbSet<ReferenceOnDerived> ReferencesOnDerived { get; set; }

public static void Seed(InheritanceRelationshipsContext context)
{
var baseCollectionsOnBase = InheritanceRelationshipsData.CreateBaseCollectionsOnBase();
var baseCollectionsOnDerived = InheritanceRelationshipsData.CreateBaseCollectionsOnDerived();
var baseEntities = InheritanceRelationshipsData.CreateBaseEntities();
var baseReferencesOnBase = InheritanceRelationshipsData.CreateBaseReferencesOnBase();
var baseReferencesOnDerived = InheritanceRelationshipsData.CreateBaseReferencesOnDerived();
var collectionsOnBase = InheritanceRelationshipsData.CreateCollectionsOnBase();
var collectionsOnDerived = InheritanceRelationshipsData.CreateCollectionsOnDerived();
var nestedCollections = InheritanceRelationshipsData.CreateNestedCollections();
var nestedReferences = InheritanceRelationshipsData.CreateNestedReferences();
var principalEntities = InheritanceRelationshipsData.CreatePrincipalEntities();
var referencedEntities = InheritanceRelationshipsData.CreateReferencedEntities();
var referencesOnBase = InheritanceRelationshipsData.CreateReferencesOnBase();
var referencesOnDerived = InheritanceRelationshipsData.CreateReferencesOnDerived();

InheritanceRelationshipsData.WireUp(
baseEntities,
baseReferencesOnBase,
baseReferencesOnDerived,
referencesOnBase,
referencesOnDerived,
nestedReferences,
baseCollectionsOnBase,
baseCollectionsOnDerived,
collectionsOnBase,
collectionsOnDerived,
nestedCollections);

context.BaseCollectionsOnBase.AddRange(baseCollectionsOnBase);
context.BaseCollectionsOnDerived.AddRange(baseCollectionsOnDerived);
context.BaseEntities.AddRange(baseEntities);
context.BaseReferencesOnBase.AddRange(baseReferencesOnBase);
context.BaseReferencesOnDerived.AddRange(baseReferencesOnDerived);
context.CollectionsOnBase.AddRange(collectionsOnBase);
context.CollectionsOnDerived.AddRange(collectionsOnDerived);
context.NestedCollections.AddRange(nestedCollections);
context.NestedReferences.AddRange(nestedReferences);
context.PrincipalEntities.AddRange(principalEntities);
context.ReferencedEntities.AddRange(referencedEntities);
context.ReferencesOnBase.AddRange(referencesOnBase);
context.ReferencesOnDerived.AddRange(referencesOnDerived);

context.SaveChanges();
}
}
}
Loading

0 comments on commit 69a3cad

Please sign in to comment.