Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting Inheritance relationship tests to AssertQuery infra #21560

Merged
merged 1 commit into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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
maumar marked this conversation as resolved.
Show resolved Hide resolved
{
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