public ProcessLevyDeclarationsCommandHandlerTestsFixture() { Fixture = new Fixture(); Now = DateTime.UtcNow; UnitOfWorkContext = new UnitOfWorkContext(); EmployerReferenceNumbers = new List <string> { "AAA111", "BBB222", "CCC333" }; Accounts = new List <Account> { Fixture.Create <Account>(), Fixture.Create <Account>() }; AccountPayeSchemes = new List <AccountPayeScheme> { new AccountPayeScheme(Accounts[0], EmployerReferenceNumbers[0], Now).Set(aps => aps.Id, 1), new AccountPayeScheme(Accounts[0], EmployerReferenceNumbers[1], Now).Set(aps => aps.Id, 2), new AccountPayeScheme(Accounts[1], EmployerReferenceNumbers[2], Now).Set(aps => aps.Id, 3) }; Command = new ProcessLevyDeclarationsCommand(Now); Db = new EmployerFinanceDbContext(new DbContextOptionsBuilder <EmployerFinanceDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options); Db.AccountPayeSchemes.AddRange(AccountPayeSchemes); Db.SaveChanges(); Handler = new ProcessLevyDeclarationsCommandHandler(Db); }
public ProcessLevyDeclarationsAdHocCommandHandlerTestsFixture() { Fixture = new Fixture(); Now = DateTime.UtcNow; UnitOfWorkContext = new UnitOfWorkContext(); //todo: //AccountPayeScheme = Fixture.Create<AccountPayeScheme>().Set(aps => aps.Id, 1); AccountPayeScheme = new AccountPayeScheme(Fixture.Create <Account>(), "AAA111", Fixture.Create <DateTime>()).Set(aps => aps.Id, 1); Command = new ProcessLevyDeclarationsAdHocCommand(Now, AccountPayeScheme.Id); Db = new EmployerFinanceDbContext(new DbContextOptionsBuilder <EmployerFinanceDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options); Db.AccountPayeSchemes.Add(AccountPayeScheme); Db.SaveChanges(); Handler = new ProcessLevyDeclarationsAdHocCommandHandler(Db); }
public UpdateLevyDeclarationTransactionBalancesCommandHandlerTestsFixture() { Fixture = new Fixture(); Now = DateTime.UtcNow; EmployerReferenceNumbers = new List <string> { "AAA111", "BBB222", "CCC333" }; Accounts = new List <Account> { Fixture.Create <Account>().Set(a => a.Id, 1), Fixture.Create <Account>().Set(a => a.Id, 2) }; AccountPayeSchemes = new List <AccountPayeScheme> { new AccountPayeScheme(Accounts[0], EmployerReferenceNumbers[0], Now).Set(aps => aps.Id, 3), new AccountPayeScheme(Accounts[0], EmployerReferenceNumbers[1], Now).Set(aps => aps.Id, 4), new AccountPayeScheme(Accounts[1], EmployerReferenceNumbers[2], Now).Set(aps => aps.Id, 5) }; Saga = ObjectActivator.CreateInstance <LevyDeclarationSaga>().Set(s => s.Id, 6); LevyDeclarationSagaTasks = AccountPayeSchemes .Select(aps => LevyDeclarationSagaTask.CreateImportPayeSchemeLevyDeclarationsTask(Saga.Id, aps.Id)) .ToList(); Command = new UpdateLevyDeclarationTransactionBalancesCommand(Saga.Id); Db = new EmployerFinanceDbContext(new DbContextOptionsBuilder <EmployerFinanceDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options); UniformSession = new Mock <IUniformSession>(); Db.AccountPayeSchemes.AddRange(AccountPayeSchemes); Db.LevyDeclarationSagas.Add(Saga); Db.LevyDeclarationSagaTasks.AddRange(LevyDeclarationSagaTasks); Db.SaveChanges(); Handler = new UpdateLevyDeclarationTransactionBalancesCommandHandler(Db, UniformSession.Object); }
public UpdateProcessLevyDeclarationsSagaProgressCommandHandlerTestsFixture() { Fixture = new Fixture(); Now = DateTime.UtcNow; UnitOfWorkContext = new UnitOfWorkContext(); PayeSchemeRefs = new List <string> { "AAA111", "BBB222", "CCC333" }; Accounts = new List <Account> { Fixture.Create <Account>(), Fixture.Create <Account>() }; AccountPayeSchemes = new List <AccountPayeScheme> { new AccountPayeScheme(Accounts[0], PayeSchemeRefs[0], Now).Set(aps => aps.Id, 1), new AccountPayeScheme(Accounts[0], PayeSchemeRefs[1], Now).Set(aps => aps.Id, 2), new AccountPayeScheme(Accounts[1], PayeSchemeRefs[2], Now).Set(aps => aps.Id, 3) }; Saga = ObjectActivator.CreateInstance <LevyDeclarationSaga>() .Set(s => s.Id, 4) .Set(s => s.PayrollPeriod, Now); Command = new UpdateLevyDeclarationSagaProgressCommand(Saga.Id); Db = new EmployerFinanceDbContext(new DbContextOptionsBuilder <EmployerFinanceDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options); UniformSession = new Mock <IUniformSession>(); Db.AccountPayeSchemes.AddRange(AccountPayeSchemes); Db.LevyDeclarationSagas.Add(Saga); Db.SaveChanges(); Handler = new UpdateLevyDeclarationSagaProgressCommandHandler(Db, UniformSession.Object); }
public ImportLevyDeclarationsCommandHandlerTestsFixture() { Fixture = new Fixture(); Now = DateTime.UtcNow; EmployerReferenceNumbers = new List <string> { "AAA111", "BBB222", "CCC333" }; Accounts = new List <Account> { Fixture.Create <Account>(), Fixture.Create <Account>() }; AccountPayeSchemes = new List <AccountPayeScheme> { new AccountPayeScheme(Accounts[0], EmployerReferenceNumbers[0], Now).Set(aps => aps.Id, 1), new AccountPayeScheme(Accounts[0], EmployerReferenceNumbers[1], Now).Set(aps => aps.Id, 2), new AccountPayeScheme(Accounts[1], EmployerReferenceNumbers[2], Now).Set(aps => aps.Id, 3) }; //todo: not sure why this doesn't work //ExcludedAccountPayeScheme = Fixture.Create<AccountPayeScheme>().Set(aps => aps.Id, 4); ExcludedAccountPayeScheme = new AccountPayeScheme(Fixture.Create <Account>(), "DDD444", Fixture.Create <DateTime>()).Set(aps => aps.Id, 4); Command = new ImportLevyDeclarationsCommand(5, Now, AccountPayeSchemes.Max(aps => aps.Id)); Db = new EmployerFinanceDbContext(new DbContextOptionsBuilder <EmployerFinanceDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options); UniformSession = new Mock <IUniformSession>(); Db.AccountPayeSchemes.AddRange(AccountPayeSchemes.Append(ExcludedAccountPayeScheme)); Db.SaveChanges(); Handler = new ImportLevyDeclarationsCommandHandler(Db, UniformSession.Object); }