Skip to content

Commit

Permalink
Portt ContainmentTests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElizabethOkerio committed Aug 27, 2024
1 parent b2cc263 commit 7692edc
Show file tree
Hide file tree
Showing 5 changed files with 1,772 additions and 7 deletions.
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]
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

0 comments on commit 7692edc

Please sign in to comment.