示例#1
0
 public AccountTestsFixture AssertCorrectPayeSchemeIsReturned(AccountPayeScheme result)
 {
     result.Should().NotBeNull();
     result.Should().Match <AccountPayeScheme>(aps => aps.AccountId == OriginalAccount.Id &&
                                               aps.EmployerReferenceNumber == EmployerReferenceNumber &&
                                               aps.Created == ActionDate);
     return(this);
 }
        public AccountPayeSchemeTestsFixture()
        {
            var fixture = new Fixture();

            ActionDate = fixture.Create <DateTime>();
            Account    = new Account(2017, "123456", "123456", "name", fixture.Create <DateTime>());

            AccountPayeScheme = new AccountPayeScheme(Account, EmployerReferenceNumber, ActionDate);
        }
示例#3
0
        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 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);
        }
 public void Delete()
 {
     AccountPayeScheme.Delete(ActionDate);
 }