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

Port ContainmentTests #3046

Merged
merged 2 commits into from
Aug 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//------------------------------------------------------------------------------

using Microsoft.OData.Edm;
using Microsoft.OData.ModelBuilder;
using Microsoft.Spatial;
using System.Collections.ObjectModel;
using EfKey = System.ComponentModel.DataAnnotations.KeyAttribute;
Expand Down Expand Up @@ -202,7 +203,11 @@ public class Company
public class PublicCompany : Company
{
public string? StockExchange { get; set; }

[Contained]
ElizabethOkerio marked this conversation as resolved.
Show resolved Hide resolved
public List<Asset>? Assets { get; set; }

[Contained]
public Club? Club { get; set; }
public LabourUnion? LabourUnion { get; set; }
}
Expand Down Expand Up @@ -243,8 +248,14 @@ public class Account
public int AccountID { get; set; }
public string? CountryRegion { get; set; }
public AccountInfo? AccountInfo { get; set; }

[Contained]
public List<PaymentInstrument>? MyPaymentInstruments { get; set; }

[Contained]
public List<Subscription>? ActiveSubscriptions { get; set; }

[Contained]
public GiftCard? MyGiftCard { get; set; }
public DateTimeOffset UpdatedTime { get; set; }
}
Expand All @@ -264,6 +275,8 @@ public class PaymentInstrument
public int PaymentInstrumentID { get; set; }
public string? FriendlyName { get; set; }
public DateTimeOffset CreatedDate { get; set; }

[Contained]
public List<Statement>? BillingStatements { get; set; }
public StoredPI? TheStoredPI { get; set; }
public StoredPI? BackupStoredPI { get; set; }
Expand All @@ -277,6 +290,8 @@ public class CreditCardPI : PaymentInstrument
public string? HolderName { get; set; }
public double Balance { get; set; }
public DateTimeOffset ExperationDate { get; set; }

[Contained]
public List<CreditRecord>? CreditRecords { get; set; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,16 @@ public void Initialize()
PaymentInstrumentID = 101901,
FriendlyName = "101 first PI",
CreatedDate = new DateTimeOffset(new DateTime(2012, 11, 1)),
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 802),
BackupStoredPI = DefaultStoredPI
},
new CreditCardPI()
{
PaymentInstrumentID = 101902,
FriendlyName = "101 frist credit PI",
CreatedDate = new DateTimeOffset(new DateTime(2012, 11, 1)),
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 801),
BackupStoredPI = DefaultStoredPI,
CVV = "234",
CardNumber = "6000000000000000",
HolderName = "Alex",
Expand Down Expand Up @@ -671,6 +675,8 @@ public void Initialize()
PaymentInstrumentID = 101903,
FriendlyName = "101 second credit PI",
CreatedDate = new DateTimeOffset(new DateTime(2012, 11, 1)),
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 804),
BackupStoredPI = DefaultStoredPI,
CVV = "012",
CardNumber = "8000000000000000",
HolderName = "James",
Expand Down Expand Up @@ -763,8 +769,10 @@ public void Initialize()
PaymentInstrumentID = 103901,
FriendlyName = "103 frist PI",
CreatedDate = new DateTimeOffset(new DateTime(2013, 10, 1)),
BillingStatements = new List<Statement>()
{
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 802),
BackupStoredPI = DefaultStoredPI,
BillingStatements =
[
new Statement()
{
StatementID = 103901001,
Expand All @@ -779,25 +787,31 @@ public void Initialize()
TransactionDescription = "Amazon purchase",
Amount = 125.0
}
}
]
},
new PaymentInstrument()
{
PaymentInstrumentID = 103902,
FriendlyName = "103 second PI",
CreatedDate = new DateTimeOffset(new DateTime(2013, 1, 1))
CreatedDate = new DateTimeOffset(new DateTime(2013, 1, 1)),
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 803),
BackupStoredPI = DefaultStoredPI
},
new PaymentInstrument()
{
PaymentInstrumentID = 103905,
FriendlyName = "103 new PI",
CreatedDate = new DateTimeOffset(new DateTime(2013, 10, 29))
CreatedDate = new DateTimeOffset(new DateTime(2013, 10, 29)),
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 805),
BackupStoredPI = DefaultStoredPI
},
new PaymentInstrument()
{
PaymentInstrumentID = 101910,
FriendlyName = "103 backup PI",
CreatedDate = new DateTimeOffset(new DateTime(2013, 6, 15))
CreatedDate = new DateTimeOffset(new DateTime(2013, 6, 15)),
TheStoredPI = this.StoredPIs.SingleOrDefault((it)=> it.StoredPIID == 805),
BackupStoredPI = DefaultStoredPI
}
],
ActiveSubscriptions =
Expand Down Expand Up @@ -885,8 +899,8 @@ public void Initialize()
ExperationDate = new DateTimeOffset(new DateTime(2013, 12, 30))
},
}

];

this.Accounts[0].AccountInfo.DynamicProperties["MiddleName"] = "Hood";
this.Accounts[0].AccountInfo.DynamicProperties["FavoriteColor"] = Color.Red;
this.Accounts[0].AccountInfo.DynamicProperties["Address"] = new Address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static IEdmModel GetEdmModel()
builder.EntitySet<Order>("Orders");
builder.EntitySet<PaymentInstrument>("PaymentInstruments");
builder.EntityType<AbstractEntity>().Abstract();
builder.EntitySet<StoredPI>("StoredPIs");
builder.EntitySet<Subscription>("SubscriptionTemplates");
builder.Singleton<StoredPI>("DefaultStoredPI");

builder.EntityType<Product>()
.Action("AddAccessRight")
Expand Down
Loading