public void CreateBatches(long totalAudits, int batchSize, int expectedTotalBatches) { var serverId = 1; var workspaceId = 1; var hourId = 2; var result = AuditWorkspaceBatcher.CreateBatches(totalAudits, batchSize, serverId, workspaceId, hourId); Assert.That(result.Count, Is.EqualTo(expectedTotalBatches)); }
public void CreateBatches_DivideByZeroException() { var serverId = 1; var workspaceId = 1; var hourId = 2; var totalAudits = 0; var batchSize = 0; Assert.Throws <DivideByZeroException>(() => AuditWorkspaceBatcher.CreateBatches(totalAudits, batchSize, serverId, workspaceId, hourId)); }
public void SetUp() { serverId = 1; workspaceId = 1; hourId = 2; var hourTimeStamp = DateTime.UtcNow; hour = new Hour { Id = hourId, HourTimeStamp = hourTimeStamp }; this.hourRepositoryMock = new Mock <IHourRepository>(); this.workspaceAuditServiceFactoryMock = new Mock <IWorkspaceAuditServiceFactory>(); this.workspaceAuditServiceMock = new Mock <IWorkspaceAuditService>(); this.workspaceAuditServiceFactoryMock.Setup(m => m.GetAuditService(workspaceId, hourId)).ReturnsAsync(this.workspaceAuditServiceMock.Object); this.loggerMock = TestUtilities.GetMockLogger(); this.auditWorkspaceBatcher = new AuditWorkspaceBatcher(this.workspaceAuditServiceFactoryMock.Object, this.loggerMock.Object); }