本文整理汇总了C#中ModelHelper.AddEeeOutputAmount方法的典型用法代码示例。如果您正苦于以下问题:C# ModelHelper.AddEeeOutputAmount方法的具体用法?C# ModelHelper.AddEeeOutputAmount怎么用?C# ModelHelper.AddEeeOutputAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelHelper
的用法示例。
在下文中一共展示了ModelHelper.AddEeeOutputAmount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: using
public async void SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_SecondSubmissionAffectsOtherProducerWhileCurrentProducerRemainsUnchanged_ReturnsOnlyOneRowForProducer()
{
var complianceYear = 2995;
var producerRegistrationNumber1 = "WEE/AW0101AW";
var producerRegistrationNumber2 = "WEE/AW0102AW";
using (var database = new DatabaseWrapper())
{
// Arrange
var helper = new ModelHelper(database.Model);
var organisation = helper.CreateOrganisation();
var scheme = helper.CreateScheme(organisation);
var memberUpload = helper.CreateSubmittedMemberUpload(scheme);
memberUpload.ComplianceYear = complianceYear;
var producer1 = helper.CreateProducerAsCompany(memberUpload, producerRegistrationNumber1);
var producer2 = helper.CreateProducerAsCompany(memberUpload, producerRegistrationNumber2);
var eeeOutputAmount1 = helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2C", 1, 101);
var eeeOutputAmount2 = helper.CreateEeeOutputAmount(producer2.RegisteredProducer, "B2C", 2, 102);
var eeeOutputAmount3 = helper.CreateEeeOutputAmount(producer2.RegisteredProducer, "B2C", 2, 112);
// Create first upload
var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme, complianceYear, 1);
dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 1);
helper.AddEeeOutputAmount(dataReturnVersion1, eeeOutputAmount1);
helper.AddEeeOutputAmount(dataReturnVersion1, eeeOutputAmount2);
// Create second upload with tonnage value changing for producer 2 only
var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme, complianceYear, 1);
dataReturnVersion2.SubmittedDate = new DateTime(2015, 2, 1);
helper.AddEeeOutputAmount(dataReturnVersion2, eeeOutputAmount1);
helper.AddEeeOutputAmount(dataReturnVersion2, eeeOutputAmount3);
database.Model.SaveChanges();
// Act
var results = await database.StoredProcedures.SpgProducerEeeHistoryCsvData(producerRegistrationNumber1);
// Assert
Assert.Equal(1, results.ProducerReturnsHistoryData.Count);
// Check first row
var result = results.ProducerReturnsHistoryData.First();
Assert.Equal(producerRegistrationNumber1, result.PRN);
Assert.Equal(1, result.Quarter);
Assert.Equal(complianceYear, result.ComplianceYear);
Assert.Equal(101, result.Cat1B2C);
Assert.Equal("Yes", result.LatestData);
Assert.Equal(new DateTime(2015, 1, 1), result.SubmittedDate);
}
}
示例2: SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_ReturnsOneRowForChangedDataEvenIfOneCategoryChanged
public async Task SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_ReturnsOneRowForChangedDataEvenIfOneCategoryChanged()
{
using (DatabaseWrapper db = new DatabaseWrapper())
{
// Arrange
ModelHelper helper = new ModelHelper(db.Model);
var scheme1 = helper.CreateScheme();
scheme1.ApprovalNumber = "WEE/TE3334ST/SCH";
var memberUpload1 = helper.CreateSubmittedMemberUpload(scheme1);
memberUpload1.ComplianceYear = 2000;
var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
producer1.ObligationType = "B2B";
var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 1);
EeeOutputAmount eeeOutputAmount = helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 2, 200);
helper.AddEeeOutputAmount(dataReturnVersion1, eeeOutputAmount);
helper.CreateEeeOutputAmount(dataReturnVersion1, producer1.RegisteredProducer, "B2B", 1, 100);
// Second upload with only category 1 changed, category 2 remains unchanged
var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
dataReturnVersion2.SubmittedDate = new DateTime(2015, 1, 2);
helper.AddEeeOutputAmount(dataReturnVersion2, eeeOutputAmount);
helper.CreateEeeOutputAmount(dataReturnVersion2, producer1.RegisteredProducer, "B2B", 1, 300);
db.Model.SaveChanges();
// Act
var results = await db.StoredProcedures.SpgProducerEeeHistoryCsvData("PRN897");
// Assert
Assert.NotNull(results);
// Only shows entries for tonnage value changes and ignores the ones with no change.
Assert.Equal(2, results.ProducerReturnsHistoryData.Count);
Assert.Collection(results.ProducerReturnsHistoryData,
(r1) => Assert.Equal(new DateTime(2015, 1, 1), r1.SubmittedDate),
(r2) => Assert.Equal(new DateTime(2015, 1, 2), r2.SubmittedDate));
Assert.Collection(results.ProducerReturnsHistoryData,
(r1) => Assert.Equal("No", r1.LatestData),
(r2) => Assert.Equal("Yes", r2.LatestData));
Assert.Collection(results.ProducerReturnsHistoryData,
(r1) => Assert.Equal(100, r1.Cat1B2B),
(r2) => Assert.Equal(300, r2.Cat1B2B));
Assert.Collection(results.ProducerReturnsHistoryData,
(r1) => Assert.Equal(200, r1.Cat2B2B),
(r2) => Assert.Equal(200, r2.Cat2B2B));
}
}
示例3: SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_OmitsDataReturnsNotChanged
public async Task SpgProducerEeeDataHistoryCsvTests_EEEDataHistory_OmitsDataReturnsNotChanged()
{
using (DatabaseWrapper db = new DatabaseWrapper())
{
//Arrange
ModelHelper helper = new ModelHelper(db.Model);
var scheme1 = helper.CreateScheme();
scheme1.ApprovalNumber = "WEE/TE3334ST/SCH";
var memberUpload1 = helper.CreateSubmittedMemberUpload(scheme1);
memberUpload1.ComplianceYear = 2000;
var producer1 = helper.CreateProducerAsCompany(memberUpload1, "PRN897");
producer1.ObligationType = "B2B";
// Create a submission
EeeOutputAmount eeeOutputAmount1 =
helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 1, 100);
EeeOutputReturnVersion eeeOutputReturnVersion1 = helper.CreateEeeOutputReturnVersion();
helper.AddEeeOutputAmount(eeeOutputReturnVersion1, eeeOutputAmount1);
var dataReturnVersion1 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
dataReturnVersion1.SubmittedDate = new DateTime(2015, 1, 1);
dataReturnVersion1.EeeOutputReturnVersion = eeeOutputReturnVersion1;
// Create two additional submissions, both having the same data
// but are different from the first
EeeOutputAmount eeeOutputAmount2 =
helper.CreateEeeOutputAmount(producer1.RegisteredProducer, "B2B", 1, 200);
EeeOutputReturnVersion eeeOutputReturnVersion2 = helper.CreateEeeOutputReturnVersion();
helper.AddEeeOutputAmount(eeeOutputReturnVersion2, eeeOutputAmount2);
var dataReturnVersion2 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
dataReturnVersion2.SubmittedDate = new DateTime(2015, 1, 2);
var dataReturnVersion3 = helper.CreateDataReturnVersion(scheme1, 2000, 1);
dataReturnVersion3.SubmittedDate = new DateTime(2015, 1, 3);
dataReturnVersion2.EeeOutputReturnVersion = eeeOutputReturnVersion2;
dataReturnVersion3.EeeOutputReturnVersion = eeeOutputReturnVersion2;
db.Model.SaveChanges();
// Act
var results = await db.StoredProcedures.SpgProducerEeeHistoryCsvData("PRN897");
//Assert
Assert.NotNull(results);
//Only shows entries for tonnage value changes and ignores the ones with no change.
Assert.Equal(2, results.ProducerReturnsHistoryData.Count);
Assert.Collection(results.ProducerReturnsHistoryData,
(r1) => Assert.Equal(new DateTime(2015, 1, 1), r1.SubmittedDate),
(r2) => Assert.Equal(new DateTime(2015, 1, 2), r2.SubmittedDate));
Assert.Collection(results.ProducerReturnsHistoryData,
(r1) => Assert.Equal("No", r1.LatestData),
(r2) => Assert.Equal("Yes", r2.LatestData));
}
}