public async Task FetchResultsAsync_WithUnsubmittedReturnData_ReturnsEmptyList() { using (Weee.Tests.Core.Model.DatabaseWrapper wrapper = new Weee.Tests.Core.Model.DatabaseWrapper()) { Organisation organisation = Organisation.CreateSoleTrader("Test Organisation"); Scheme scheme = new Scheme(organisation); Quarter quarter = new Quarter(2099, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); DataReturnVersion version = new DataReturnVersion(dataReturn); WeeeCollectedAmount amount1 = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amount1); wrapper.WeeeContext.DataReturns.Add(dataReturn); await wrapper.WeeeContext.SaveChangesAsync(); // Act FetchSummaryCsvDataAccess dataAccess = new FetchSummaryCsvDataAccess(wrapper.WeeeContext); List<DataReturnSummaryCsvData> results = await dataAccess.FetchResultsAsync(scheme.Id, 2099); // Assert Assert.NotNull(results); Assert.Empty(results); } }
public EeeValidator(Scheme scheme, Quarter quarter, Func<Scheme, Quarter, IDataReturnVersionBuilderDataAccess> dataAccessDelegate) { this.scheme = scheme; this.quarter = quarter; schemeQuarterDataAccess = dataAccessDelegate(scheme, quarter); }
public async Task HandleAsync_SendsEmailWithSchemeName() { // Arrange string emailAddress = "*****@*****.**"; var competentAuthority = new UKCompetentAuthority(Guid.NewGuid(), "Name", "Abbreviation", A.Dummy<Country>(), emailAddress); Scheme scheme = A.Fake<Scheme>(); A.CallTo(() => scheme.CompetentAuthority) .Returns(competentAuthority); A.CallTo(() => scheme.SchemeName) .Returns("Test Scheme Name"); Quarter quarter = new Quarter(2016, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); DataReturnVersion dataReturnVersion = new DataReturnVersion(dataReturn); dataReturnVersion.Submit("testUserId"); var schemeSubmissionEvent = new SchemeDataReturnSubmissionEvent(dataReturnVersion); var emailService = A.Fake<IWeeeEmailService>(); var dataAccess = A.Dummy<ISchemeDataReturnSubmissionEventHandlerDataAccess>(); var handler = new SchemeDataReturnSubmissionEventHandler(emailService, dataAccess); // Act await handler.HandleAsync(schemeSubmissionEvent); // Assert A.CallTo(() => emailService.SendSchemeDataReturnSubmitted(A<string>._, "Test Scheme Name", A<int>._, A<int>._, A<bool>._)) .MustHaveHappened(Repeated.Exactly.Once); }
public DataReturn(Scheme scheme, Quarter quarter) { Guard.ArgumentNotNull(() => scheme, scheme); Guard.ArgumentNotNull(() => quarter, quarter); Scheme = scheme; Quarter = quarter; }
public void DataReturn_SchemeNotDefined_ThrowsArugmentNullException() { // Arrange Quarter quarter = new Quarter(2016, QuarterType.Q1); // Assert Assert.Throws<ArgumentNullException>(() => new DataReturn(null, quarter)); }
public void ResizeQrects(Size ClientSize) { Size s = new Size(ClientSize.Width / 2, ClientSize.Height / 2); QRects[(int)Quarter.First] = new Rectangle(new Point(0, 0), s); QRects[(int)Quarter.Second] = new Rectangle(new Point(s.Width + 1, 0), s); QRects[(int)Quarter.Third] = new Rectangle(new Point(s.Width + 1, s.Height + 1), s); QRects[(int)Quarter.Forth] = new Rectangle(new Point(0, s.Height + 1), s); previousQuarter = Quarter.None; }
public static DateTime GetEndOfQuarter(int Year, Quarter Qtr) { if (Qtr == Quarter.First) return new DateTime(Year, 3, DateTime.DaysInMonth(Year, 3), 23, 59, 59, 999); if (Qtr == Quarter.Second) return new DateTime(Year, 6, DateTime.DaysInMonth(Year, 6), 23, 59, 59, 999); if (Qtr == Quarter.Third) return new DateTime(Year, 9, DateTime.DaysInMonth(Year, 9), 23, 59, 59, 999); return new DateTime(Year, 12, DateTime.DaysInMonth(Year, 12), 23, 59, 59, 999); }
public async Task<QuarterWindow> GetQuarterWindow(Quarter quarter) { // Otherwise calculate submission window var quarterWindowTemplate = await dataAccess.GetByQuarter((int)quarter.Q); var startDate = new DateTime(quarter.Year + quarterWindowTemplate.AddStartYears, quarterWindowTemplate.StartMonth, quarterWindowTemplate.StartDay); var endDate = new DateTime(quarter.Year + quarterWindowTemplate.AddEndYears, quarterWindowTemplate.EndMonth, quarterWindowTemplate.EndDay); return new QuarterWindow(startDate, endDate); }
public static DateTime GetStartOfQuarter(int Year, Quarter Qtr) { if (Qtr == Quarter.First) // 1st Quarter = January 1 to March 31 return new DateTime(Year, 1, 1, 0, 0, 0, 0); else if (Qtr == Quarter.Second) // 2nd Quarter = April 1 to June 30 return new DateTime(Year, 4, 1, 0, 0, 0, 0); else if (Qtr == Quarter.Third) // 3rd Quarter = July 1 to September 30 return new DateTime(Year, 7, 1, 0, 0, 0, 0); else // 4th Quarter = October 1 to December 31 return new DateTime(Year, 10, 1, 0, 0, 0, 0); }
public static DateTime GetEndOfQuarter(int Year, Quarter Qtr) { if (Qtr == Quarter.First) // 1st Quarter = January 1 to March 31 return new DateTime(Year, 3, DateTime.DaysInMonth(Year, 3), 23, 59, 59, 999); else if (Qtr == Quarter.Second) // 2nd Quarter = April 1 to June 30 return new DateTime(Year, 6, DateTime.DaysInMonth(Year, 6), 23, 59, 59, 999); else if (Qtr == Quarter.Third) // 3rd Quarter = July 1 to September 30 return new DateTime(Year, 9, DateTime.DaysInMonth(Year, 9), 23, 59, 59, 999); else // 4th Quarter = October 1 to December 31 return new DateTime(Year, 12, DateTime.DaysInMonth(Year, 12), 23, 59, 59, 999); }
public void SetCurrentDataReturnVersion_ThrowsArugmentNullException() { // Arrange Scheme scheme = new Scheme(Guid.NewGuid()); Quarter quarter = new Quarter(2016, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); // Act Action action = () => dataReturn.SetCurrentVersion(null); // Assert Assert.Throws<ArgumentNullException>(action); }
public void SetCurrentDataReturnVersion_ThrowInvalidOperationException() { // Arrange Scheme scheme = new Scheme(Guid.NewGuid()); Quarter quarter = new Quarter(2016, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); DataReturnVersion version = new DataReturnVersion(new DataReturn(scheme, quarter)); // Act Action action = () => dataReturn.SetCurrentVersion(version); // Assert Assert.Throws<InvalidOperationException>(action); }
public void ctor_SerializationInfo_StreamingContext() { var expected = new Quarter(1999, 3); Quarter actual; using (Stream stream = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(stream, new Quarter(1999, 3)); stream.Position = 0; actual = (Quarter)formatter.Deserialize(stream); } Assert.Equal(expected, actual); }
public void AddNewAnime(int year, Quarter quarter, String title, String description, String bannerPath, int state) { Issue[] issues = _issueList.Where(i => i.IsSame(year, quarter)).ToArray(); Issue issue; if (issues.Length == 0) { issue = new Issue(year, quarter); _issueList.Add(issue); } else { issue = issues.First(); } Anime anime = new Anime(issue, title, description, bannerPath, (AnimeState)state); _animes.Add(anime); }
private Brush GetBrushFromQ(Quarter q) { switch (q) { case Quarter.First: return Brushes.Red; case Quarter.Second: return Brushes.Yellow; case Quarter.Third: return Brushes.Green; case Quarter.Forth: return Brushes.Blue; default: return Brushes.Gray; } }
private Color GetColorFromQ(Quarter q) { switch (q) { case Quarter.First: return Color.Red; case Quarter.Second: return Color.Yellow; case Quarter.Third: return Color.Green; case Quarter.Forth: return Color.Blue; default: return Color.Gray; } }
private Color GetBackColorFromQ(Quarter q) { switch (q) { case Quarter.First: return Color.Pink; case Quarter.Second: return Color.LightYellow; case Quarter.Third: return Color.LightGreen; case Quarter.Forth: return Color.LightBlue; default: return Color.Gray; } }
public async Task FetchResultsAsync_WithReturnDataForTowQuarters_ReturnsOneResultForEachQuarter() { using (Weee.Tests.Core.Model.DatabaseWrapper wrapper = new Weee.Tests.Core.Model.DatabaseWrapper()) { // Arrange Organisation organisation = Organisation.CreateSoleTrader("Test Organisation"); Scheme scheme = new Scheme(organisation); Quarter quarter1 = new Quarter(2099, QuarterType.Q1); DataReturn dataReturnQ1 = new DataReturn(scheme, quarter1); DataReturnVersion versionQ1 = new DataReturnVersion(dataReturnQ1); WeeeCollectedAmount amountQ1 = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); versionQ1.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amountQ1); wrapper.WeeeContext.DataReturns.Add(dataReturnQ1); await wrapper.WeeeContext.SaveChangesAsync(); dataReturnQ1.SetCurrentVersion(versionQ1); await wrapper.WeeeContext.SaveChangesAsync(); Quarter quarter2 = new Quarter(2099, QuarterType.Q2); DataReturn dataReturnQ2 = new DataReturn(scheme, quarter2); DataReturnVersion versionQ2 = new DataReturnVersion(dataReturnQ2); WeeeCollectedAmount amountQ2 = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); versionQ2.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amountQ2); wrapper.WeeeContext.DataReturns.Add(dataReturnQ2); await wrapper.WeeeContext.SaveChangesAsync(); dataReturnQ2.SetCurrentVersion(versionQ2); await wrapper.WeeeContext.SaveChangesAsync(); // Act FetchSummaryCsvDataAccess dataAccess = new FetchSummaryCsvDataAccess(wrapper.WeeeContext); List<DataReturnSummaryCsvData> results = await dataAccess.FetchResultsAsync(scheme.Id, 2099); // Assert Assert.NotNull(results); Assert.Equal(2, results.Count); Assert.Collection(results, r => Assert.Equal(1, r.Quarter), r => Assert.Equal(2, r.Quarter)); } }
public void op_ToQuarter_DirectoryInfo() { using (var temp = new TempDirectory()) { var file = temp.Info.ToDirectory("1969 Q1", true); var expected = new Quarter(1969, QuarterOfYear.Q1); var actual = file.ToQuarter(); Assert.Equal(expected, actual); } }
public async Task FetchResultsAsync_WithLargeHouseHoldAppliancesAmount_ReturnsNullForAllOtherCategories() { using (Weee.Tests.Core.Model.DatabaseWrapper wrapper = new Weee.Tests.Core.Model.DatabaseWrapper()) { // Arrange Organisation organisation = Organisation.CreateSoleTrader("Test Organisation"); Scheme scheme = new Scheme(organisation); Quarter quarter = new Quarter(2099, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); DataReturnVersion version = new DataReturnVersion(dataReturn); WeeeCollectedAmount amount1 = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amount1); wrapper.WeeeContext.DataReturns.Add(dataReturn); await wrapper.WeeeContext.SaveChangesAsync(); dataReturn.SetCurrentVersion(version); await wrapper.WeeeContext.SaveChangesAsync(); // Act FetchSummaryCsvDataAccess dataAccess = new FetchSummaryCsvDataAccess(wrapper.WeeeContext); List<DataReturnSummaryCsvData> results = await dataAccess.FetchResultsAsync(scheme.Id, 2099); // Assert Assert.NotNull(results); Assert.Equal(1, results.Count); DataReturnSummaryCsvData result = results[0]; Assert.NotNull(result); Assert.NotNull(result.Category1); Assert.Null(result.Category2); Assert.Null(result.Category3); Assert.Null(result.Category4); Assert.Null(result.Category5); Assert.Null(result.Category6); Assert.Null(result.Category7); Assert.Null(result.Category8); Assert.Null(result.Category9); Assert.Null(result.Category10); Assert.Null(result.Category11); Assert.Null(result.Category12); Assert.Null(result.Category13); Assert.Null(result.Category14); } }
public async Task Execute_WithoutSchemeFilter_ReturnsResultsForAllSchemes() { using (DatabaseWrapper wrapper = new DatabaseWrapper()) { // Arrange Domain.Organisation.Organisation organisation = Domain.Organisation.Organisation.CreateSoleTrader("Test Organisation"); Domain.UKCompetentAuthority authority = wrapper.WeeeContext.UKCompetentAuthorities.Single(c => c.Abbreviation == "EA"); Quarter quarter = new Quarter(2099, QuarterType.Q1); // Arrange - Scheme 1 Domain.Scheme.Scheme scheme1 = new Domain.Scheme.Scheme(organisation); scheme1.UpdateScheme("Test Scheme 1", "WEE/AH7453NF/SCH", "WEE9462846", ObligationType.B2C, authority); scheme1.SetStatus(Domain.Scheme.SchemeStatus.Approved); Domain.DataReturns.DataReturn dataReturn1 = new Domain.DataReturns.DataReturn(scheme1, quarter); Domain.DataReturns.DataReturnVersion version1 = new Domain.DataReturns.DataReturnVersion(dataReturn1); Domain.DataReturns.WeeeCollectedAmount amount1 = new Domain.DataReturns.WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version1.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amount1); wrapper.WeeeContext.DataReturnVersions.Add(version1); await wrapper.WeeeContext.SaveChangesAsync(); dataReturn1.SetCurrentVersion(version1); await wrapper.WeeeContext.SaveChangesAsync(); // Arrange - Scheme 2 Domain.Scheme.Scheme scheme2 = new Domain.Scheme.Scheme(organisation); scheme2.UpdateScheme("Test Scheme 2", "WEE/ZU6355HV/SCH", "WEE5746395", ObligationType.B2C, authority); scheme2.SetStatus(Domain.Scheme.SchemeStatus.Approved); Domain.DataReturns.DataReturn dataReturn2 = new Domain.DataReturns.DataReturn(scheme2, quarter); Domain.DataReturns.DataReturnVersion version2 = new Domain.DataReturns.DataReturnVersion(dataReturn2); Domain.DataReturns.WeeeCollectedAmount amount2 = new Domain.DataReturns.WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version2.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amount2); wrapper.WeeeContext.DataReturnVersions.Add(version2); await wrapper.WeeeContext.SaveChangesAsync(); dataReturn2.SetCurrentVersion(version2); await wrapper.WeeeContext.SaveChangesAsync(); // Act SpgSchemeWeeeCsvResult result = await wrapper.WeeeContext.StoredProcedures.SpgSchemeWeeeCsvAsync( 2099, null, "B2C"); // Assert Assert.NotNull(result); Assert.NotNull(result.Schemes); Assert.Equal(2, result.Schemes.Count); Assert.NotNull(result.CollectedAmounts); Assert.Equal(2, result.CollectedAmounts.Count); } }
void InitQrects() { QRects = new Rectangle[4]; previousQuarter = Quarter.First; }
public async Task FetchResultsAsync_WithSeveralOutputAmounts_ReturnsSumOfAmounts() { using (Weee.Tests.Core.Model.DatabaseWrapper wrapper = new Weee.Tests.Core.Model.DatabaseWrapper()) { // Arrange Organisation organisation = Organisation.CreateSoleTrader("Test Organisation"); Scheme scheme = new Scheme(organisation); RegisteredProducer registeredProducer1 = new RegisteredProducer("WEE/AA1111AA", 2099, scheme); RegisteredProducer registeredProducer2 = new RegisteredProducer("WEE/BB2222BB", 2099, scheme); Quarter quarter = new Quarter(2099, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); DataReturnVersion version = new DataReturnVersion(dataReturn); EeeOutputAmount amount1 = new EeeOutputAmount( ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 100, registeredProducer1); version.EeeOutputReturnVersion.AddEeeOutputAmount(amount1); EeeOutputAmount amount2 = new EeeOutputAmount( ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 200, registeredProducer2); version.EeeOutputReturnVersion.AddEeeOutputAmount(amount2); wrapper.WeeeContext.DataReturns.Add(dataReturn); await wrapper.WeeeContext.SaveChangesAsync(); dataReturn.SetCurrentVersion(version); await wrapper.WeeeContext.SaveChangesAsync(); // Act FetchSummaryCsvDataAccess dataAccess = new FetchSummaryCsvDataAccess(wrapper.WeeeContext); List<DataReturnSummaryCsvData> results = await dataAccess.FetchResultsAsync(scheme.Id, 2099); // Assert Assert.NotNull(results); Assert.Equal(1, results.Count); DataReturnSummaryCsvData result = results[0]; Assert.NotNull(result); Assert.Equal(300, result.Category1); } }
public QRect(Size ClientSize) { InitQrects(); ResizeQrects(ClientSize); previousQuarter = Quarter.First; }
//internal Rectangle InvalidRect(Point mousePosition, Size size) //{ // Rectangle a, b; // int x,y,width,height; // presentQuarter = GetQfromPoint(mousePosition,size); // if (previousQuarter != presentQuarter && previousQuarter != Quarter.None) // { // a = QRects[(int)previousQuarter]; // b = QRects[(int)presentQuarter]; // previousQuarter = presentQuarter; // x = min(a.X, b.X); // y = min(a.Y, b.Y); // width = abs(a.X - b.X) + a.Width; // height = abs(a.Y - b.Y) + a.Height; // return new Rectangle(x, y, width, height); // } // else // return new Rectangle(); //} internal Region InvalidRegion(Point mousePosition, Size size) { presentQuarter = GetQfromPoint(mousePosition, size); if (previousQuarter != presentQuarter) { Region r = new Region(QRects[(int)presentQuarter]); if (previousQuarter != Quarter.None) r.Union(QRects[(int)previousQuarter]); previousQuarter = presentQuarter; return r; } else return new Region(new Rectangle(0, 0, 0, 0)); }
static Quarter() { First = new Quarter() { name = "第一季度", start = 1, end = 3, enname = "First Quarter" }; Second = new Quarter() { name = "第二季度", start = 4, end = 6, enname = "Second Quarter" }; Third = new Quarter() { name = "第三季度", start = 7, end = 9, enname = "Third Quarter" }; Forth = new Quarter() { name = "第四季度", start = 10, end = 12, enname = "Forth Quarter" }; Quarters = new List<Quarter>(); Quarters.Add(First); Quarters.Add(Second); Quarters.Add(Third); Quarters.Add(Forth); }
public async Task FetchResultsAsync_WithOneAmountOfEachTypeAndSourceAndObligationType_ReturnsResultForEachAmountWithCorrectOrdering() { using (Weee.Tests.Core.Model.DatabaseWrapper wrapper = new Weee.Tests.Core.Model.DatabaseWrapper()) { // Arrange Organisation organisation = Organisation.CreateSoleTrader("Test Organisation"); Scheme scheme = new Scheme(organisation); RegisteredProducer registeredProducer1 = new RegisteredProducer("WEE/AA9365AA", 2099, scheme); Quarter quarter = new Quarter(2099, QuarterType.Q1); DataReturn dataReturn = new DataReturn(scheme, quarter); DataReturnVersion version = new DataReturnVersion(dataReturn); WeeeCollectedAmount amountCollectedDcfB2C = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amountCollectedDcfB2C); WeeeCollectedAmount amountCollectedDistributor = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Distributor, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amountCollectedDistributor); WeeeCollectedAmount amountCollectedFinalHolder = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.FinalHolder, ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m); version.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amountCollectedFinalHolder); WeeeDeliveredAmount amountDeliveredAatfB2C = new WeeeDeliveredAmount( ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m, new AatfDeliveryLocation("WEE/AA6845AA/ATF", string.Empty)); version.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(amountDeliveredAatfB2C); WeeeDeliveredAmount amountDeliveredAeB2C = new WeeeDeliveredAmount( ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m, new AeDeliveryLocation("WEE/AA2658AA/AE", string.Empty)); version.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(amountDeliveredAeB2C); EeeOutputAmount amountOutputB2C = new EeeOutputAmount( ObligationType.B2C, WeeeCategory.LargeHouseholdAppliances, 123.456m, registeredProducer1); version.EeeOutputReturnVersion.AddEeeOutputAmount(amountOutputB2C); WeeeCollectedAmount amountCollectedDcfB2B = new WeeeCollectedAmount( WeeeCollectedAmountSourceType.Dcf, ObligationType.B2B, WeeeCategory.LargeHouseholdAppliances, 123.456m); version.WeeeCollectedReturnVersion.AddWeeeCollectedAmount(amountCollectedDcfB2B); WeeeDeliveredAmount amountDeliveredAatfB2B = new WeeeDeliveredAmount( ObligationType.B2B, WeeeCategory.LargeHouseholdAppliances, 123.456m, new AatfDeliveryLocation("WEE/AA7445AA/ATF", string.Empty)); version.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(amountDeliveredAatfB2B); WeeeDeliveredAmount amountDeliveredAeB2B = new WeeeDeliveredAmount( ObligationType.B2B, WeeeCategory.LargeHouseholdAppliances, 123.456m, new AeDeliveryLocation("WEE/AA3658AA/AE", string.Empty)); version.WeeeDeliveredReturnVersion.AddWeeeDeliveredAmount(amountDeliveredAeB2B); EeeOutputAmount amountOutputB2B = new EeeOutputAmount( ObligationType.B2B, WeeeCategory.LargeHouseholdAppliances, 123.456m, registeredProducer1); version.EeeOutputReturnVersion.AddEeeOutputAmount(amountOutputB2B); wrapper.WeeeContext.DataReturns.Add(dataReturn); await wrapper.WeeeContext.SaveChangesAsync(); dataReturn.SetCurrentVersion(version); await wrapper.WeeeContext.SaveChangesAsync(); // Act FetchSummaryCsvDataAccess dataAccess = new FetchSummaryCsvDataAccess(wrapper.WeeeContext); List<DataReturnSummaryCsvData> results = await dataAccess.FetchResultsAsync(scheme.Id, 2099); // Assert Assert.NotNull(results); Assert.Equal(10, results.Count); Assert.Collection(results, r => { Assert.Equal(0, r.Type); Assert.Equal(0, r.Source); Assert.Equal("B2C", r.ObligationType); }, r => { Assert.Equal(0, r.Type); Assert.Equal(0, r.Source); Assert.Equal("B2B", r.ObligationType); }, r => { Assert.Equal(0, r.Type); Assert.Equal(1, r.Source); Assert.Equal("B2C", r.ObligationType); }, r => { Assert.Equal(0, r.Type); Assert.Equal(2, r.Source); Assert.Equal("B2C", r.ObligationType); }, r => { Assert.Equal(1, r.Type); Assert.Equal(0, r.Source); Assert.Equal("B2C", r.ObligationType); }, r => { Assert.Equal(1, r.Type); Assert.Equal(0, r.Source); Assert.Equal("B2B", r.ObligationType); }, r => { Assert.Equal(1, r.Type); Assert.Equal(1, r.Source); Assert.Equal("B2C", r.ObligationType); }, r => { Assert.Equal(1, r.Type); Assert.Equal(1, r.Source); Assert.Equal("B2B", r.ObligationType); }, r => { Assert.Equal(2, r.Type); Assert.Equal(null, r.Source); Assert.Equal("B2C", r.ObligationType); }, r => { Assert.Equal(2, r.Type); Assert.Equal(null, r.Source); Assert.Equal("B2B", r.ObligationType); }); } }
public DataReturnVersionBuilderHelper() { Scheme = A.Dummy<Scheme>(); Quarter = A.Dummy<Quarter>(); EeeValidator = A.Fake<IEeeValidator>(); DataAccess = A.Fake<IDataReturnVersionBuilderDataAccess>(); SubmissionWindowClosed = A.Fake<ISubmissionWindowClosed>(); dataAccessDelegate = (x, y) => DataAccess; eeeValidatorDelegate = (s, q, z) => EeeValidator; }
public DataReturnVersionBuilderExtension(Scheme scheme, Quarter quarter, Func<Scheme, Quarter, Func<Scheme, Quarter, IDataReturnVersionBuilderDataAccess>, IEeeValidator> eeeValidatorDelegate, Func<Scheme, Quarter, IDataReturnVersionBuilderDataAccess> dataAccessDelegate, ISubmissionWindowClosed submissionWindowClosed, List<ErrorData> errorData) : base(scheme, quarter, eeeValidatorDelegate, dataAccessDelegate, submissionWindowClosed) { Errors = errorData; }
public void CreateANewUSCoin() { Quarter quarter = new Quarter(); Assert.AreEqual(quarter.Price.Value, 0.25f); }