public WorkEventLogTest() { this.address = this.addressFactory.Create(); this.permissionManager = new ContractExecutor(this.addressFactory.Create()); this.contractRegistry = new ContractRegistry(); this.workTracker = new WorkTracker.WorkTracker(this.addressFactory.Create(), this.contractRegistry, this.permissionManager.Address); var perm = new Permission(typeof(TrackWorkAction)); var addPerm = new AddPermissionAction(string.Empty, this.workTracker.Address, perm, this.permissionManager.Address); this.contractRegistry.RegisterContract(this.permissionManager); this.contractRegistry.RegisterContract(this.workTracker); this.permissionManager.ExecuteAction(addPerm); var eventSet = new HashSet <WorkEventArgs>() { new WorkEventArgs(5, new DateTime(2019, 5, 13), this.address), new WorkEventArgs(5, new DateTime(2019, 5, 14), this.address), new WorkEventArgs(5, new DateTime(2019, 5, 15), this.address), new WorkEventArgs(5, new DateTime(2019, 5, 16), this.address), }; this.eventLog = new WorkEventLog(30, eventSet, this.workTracker); }
private void InitializeEventLogAndGuards() { var eventSet = new HashSet <WorkEventArgs>() { new WorkEventArgs(5, new DateTime(2019, 5, 13), this.address), new WorkEventArgs(5, new DateTime(2019, 5, 14), this.address), new WorkEventArgs(5, new DateTime(2019, 5, 15), this.address), new WorkEventArgs(5, new DateTime(2019, 5, 16), this.address), }; this.workTracker = new WorkTracker.WorkTracker(this.addressFactory.Create(), this.contractRegistry, this.permissionManager.Address); this.contractRegistry.RegisterContract(this.workTracker); this.ConfigurePermissions(); this.eventLog = new WorkEventLog(30, eventSet, this.workTracker); var addGuard = new AddTrackerGuardAction(string.Empty, this.workTracker.Address, new WeeklyTrackerGuard(this.eventLog)); this.permissionManager.ExecuteAction(addGuard); addGuard = new AddTrackerGuardAction(string.Empty, this.workTracker.Address, new MonthlyTrackerGuard(this.eventLog)); this.permissionManager.ExecuteAction(addGuard); addGuard = new AddTrackerGuardAction(string.Empty, this.workTracker.Address, new FutureDateTrackerGuard()); this.permissionManager.ExecuteAction(addGuard); }
public MonthlyTrackerGuardTest() { this.address = this.addressFactory.Create(); var eventSet = new HashSet <WorkEventArgs>() { new WorkEventArgs(40, new DateTime(2019, 5, 13), this.address), new WorkEventArgs(40, new DateTime(2019, 5, 14), this.address), new WorkEventArgs(40, new DateTime(2019, 5, 15), this.address), new WorkEventArgs(40, new DateTime(2019, 5, 16), this.address), }; this.workTracker = new WorkTracker.WorkTracker(null, null, null); this.eventLog = new WorkEventLog(30, eventSet, this.workTracker); this.trackerGuard = new MonthlyTrackerGuard(this.eventLog, 176); }
public MonthlyTrackerGuard(WorkEventLog eventLog, decimal hoursPerMonth = 176) : base("MonthlyTrackerGuardBase", eventLog) { this.HoursPerMonth = hoursPerMonth; }
public WeeklyTrackerGuard(WorkEventLog eventLog, decimal hoursPerWeek = 40) : base("WeeklyTracketGuard", eventLog) { this.HoursPerWeek = hoursPerWeek; }