Exemplo n.º 1
0
 public NotificationService(HttpSelfHostConfiguration config, IScheduler scheduler, IScheduleFactory scheduleFactory, IServiceFactory serviceFactory)
 {
     _config          = config;
     _scheduler       = scheduler;
     _scheduleFactory = scheduleFactory;
     _serviceFactory  = serviceFactory;
 }
        public void Initialize()
        {
            fakeBankAccountRepository = new FakeBankAccountRepository();

            mockTransferFrequencyDateCalculatorFactory = new Mock <IScheduleFrequencyFactory>();
            mockTransferDirectionGenerator             = new Mock <ITransferDirectionGenerator>();

            mockTransferFrequencyDateCalculatorMonthly = new Mock <IScheduleFrequency>();

            mockTransferFrequencyDateCalculatorMonthly.Setup(s => s.CalculateNextDate(It.IsAny <Schedule>(), It.IsAny <DateTime>()))
            .Returns((Transfer t, DateTime d) => d.AddMonths(1));


            allAccounts = new List <CashflowBankAccount>();

            sut = new CashflowProjectionTransferGenerator(
                fakeBankAccountRepository,
                //mockTransferFrequencyDateCalculatorFactory.Object,
                mockTransferDirectionGenerator.Object
                );

            scheduleFrequencyCalculators = new IScheduleFrequency[] {
                new ScheduleFrequencyMonthly(),
                new ScheduleFrequencyWeekly()
            };

            scheduleFactory = new Fakes.FakeScheduleFactory();
        }
        public void Initialize()
        {
            fakeBankAccountRepository = new FakeBankAccountRepository();

            mockTransferFrequencyDateCalculatorFactory = new Mock<IScheduleFrequencyFactory>();
            mockTransferDirectionGenerator = new Mock<ITransferDirectionGenerator>();

            mockTransferFrequencyDateCalculatorMonthly = new Mock<IScheduleFrequency>();

            mockTransferFrequencyDateCalculatorMonthly.Setup(s => s.CalculateNextDate(It.IsAny<Schedule>(), It.IsAny<DateTime>()))
                .Returns((Transfer t, DateTime d) => d.AddMonths(1));

            allAccounts = new List<CashflowBankAccount>();

            sut = new CashflowProjectionTransferGenerator(
                                    fakeBankAccountRepository,
                                    //mockTransferFrequencyDateCalculatorFactory.Object,
                                    mockTransferDirectionGenerator.Object
                                    );

            scheduleFrequencyCalculators = new IScheduleFrequency[] {
                                new ScheduleFrequencyMonthly(),
                                new ScheduleFrequencyWeekly() };

            scheduleFactory = new Fakes.FakeScheduleFactory();
        }
Exemplo n.º 4
0
        public SeasonService(ApplicationDbContext dbContext, IScheduleFactory scheduleFactory, ISeasonPointCalculator pointCalculator, ITieBreakerFactory tieBreakerFactory)
        {
            this.dbContext       = dbContext;
            this.scheduleFactory = scheduleFactory;
            this.pointCalculator = pointCalculator;

            tieBreaker = tieBreakerFactory.Create();
        }
Exemplo n.º 5
0
        public Transfer(IScheduleFactory scheduleFactory)
        {
            this.scheduleFactory = scheduleFactory;

            //FromBankAccount = new BankAccount();
            //ToBankAccount = new BankAccount();
            this.Schedule = this.scheduleFactory.Create();
            //this.FrequencyEvery = 1;
        }
Exemplo n.º 6
0
        public Transfer(IScheduleFactory scheduleFactory)
        {
            this.scheduleFactory = scheduleFactory;

            //FromBankAccount = new BankAccount();
            //ToBankAccount = new BankAccount();
            this.Schedule = this.scheduleFactory.Create();
            //this.FrequencyEvery = 1;
        }
Exemplo n.º 7
0
        public void SetUp()
        {
            dbContext       = DbContextUtility.CreateMockDb();
            scheduler       = Substitute.For <IScheduleFactory>();
            pointCalculator = Substitute.For <ISeasonPointCalculator>();
            var tieBreakerFactory = Substitute.For <ITieBreakerFactory>();

            tieBreaker = Substitute.For <ITieBreaker>();

            tieBreakerFactory.Create().Returns(tieBreaker);

            testObj = new SeasonService(dbContext, scheduler, pointCalculator, tieBreakerFactory);
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="NotificationServiceControl" /> class.
        /// </summary>
        /// <param name="bus">The bus.</param>
        /// <param name="scheduler">The scheduler.</param>
        /// <param name="serviceConfig">The service configuration.</param>
        /// <param name="scheduleFactory">The schedule factory.</param>
        public NotificationServiceControl(IBusControl bus, IScheduler scheduler, IServiceConfig serviceConfig, IScheduleFactory scheduleFactory)
            : base(bus)
        {
            Contract.Requires(bus != null);
            Contract.Requires(scheduler != null);
            Contract.Requires(serviceConfig != null);
            Contract.Requires(scheduleFactory != null);

            _bus             = bus;
            _scheduler       = scheduler;
            _serviceConfig   = serviceConfig;
            _scheduleFactory = scheduleFactory;
        }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultTaskCreator"/> class.
 /// </summary>
 /// <param name="taskFactory">
 /// The task factory.
 /// </param>
 /// <param name="scheduleFactory">
 /// The schedule factory.
 /// </param>
 public DefaultTaskCreator(ITaskFactory taskFactory, IScheduleFactory scheduleFactory)
 {
     this.taskFactory     = taskFactory;
     this.scheduleFactory = scheduleFactory;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor for the Class GetPaymentForEmployeeQuery
 /// </summary>
 /// <param name="employeeFactory">Factory for buildig the employee</param>
 /// <param name="scheduleFactory">Factory for buildig the schedule</param>
 public GetPaymentForEmployeeQuery(IEmployeeFactory employeeFactory
                                   , IScheduleFactory scheduleFactory)
 {
     _employeeFactory = employeeFactory;
     _scheduleFactory = scheduleFactory;
 }
Exemplo n.º 11
0
 public FScheduleConsole()
 {
     _schedules = new FSchedules(this);
     _factory   = new FScheduleFactory();
     _timer     = new FScheduleTimer(this);
 }
Exemplo n.º 12
0
 public FakeTransferFactory(IScheduleFactory scheduleFactory)
 {
     this.scheduleFactory = scheduleFactory;
 }
Exemplo n.º 13
0
 public FakeTransferFactory(IScheduleFactory scheduleFactory)
 {
     this.scheduleFactory = scheduleFactory;
 }