Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
7a129490
Commit
7a129490
authored
Jul 19, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused files.
parent
3a205b0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
241 deletions
+0
-241
ComputedJobTest.cs
test/DotNetCore.CAP.Test/Job/ComputedJobTest.cs
+0
-56
JobProcessingServerTest.cs
test/DotNetCore.CAP.Test/Job/JobProcessingServerTest.cs
+0
-185
No files found.
test/DotNetCore.CAP.Test/Job/ComputedJobTest.cs
deleted
100644 → 0
View file @
3a205b0b
//using System;
//using System.Collections.Generic;
//using System.Text;
//using DotNetCore.CAP.Processor;
//using Xunit;
//namespace DotNetCore.CAP.Test.Job
//{
// public class ComputedJobTest
// {
// [Fact]
// public void UpdateNext_LastRunNever_SchedulesNow()
// {
// // Arrange
// var now = new DateTime(2000, 1, 1, 8, 0, 0);
// var cronJob = new CronJob(Cron.Daily());
// var computed = new ComputedCronJob(cronJob);
// // Act
// computed.UpdateNext(now);
// // Assert
// Assert.Equal(computed.Next, now);
// }
// [Fact]
// public void UpdateNext_LastRun_BeforePrev_SchedulesNow()
// {
// // Arrange
// var now = new DateTime(2000, 1, 1, 8, 0, 0);
// var cronJob = new CronJob(Cron.Daily(), now.Subtract(TimeSpan.FromDays(2)));
// var computed = new ComputedCronJob(cronJob);
// // Act
// computed.UpdateNext(now);
// // Assert
// Assert.Equal(computed.Next, now);
// }
// [Fact]
// public void UpdateNext_LastRun_AfterPrev_SchedulesNormal()
// {
// // Arrange
// var now = new DateTime(2000, 1, 1, 8, 0, 0);
// var cronJob = new CronJob(Cron.Daily(), now.Subtract(TimeSpan.FromSeconds(5)));
// var computed = new ComputedCronJob(cronJob);
// // Act
// computed.UpdateNext(now);
// // Assert
// Assert.True(computed.Next > now);
// }
// }
//}
\ No newline at end of file
test/DotNetCore.CAP.Test/Job/JobProcessingServerTest.cs
deleted
100644 → 0
View file @
3a205b0b
//using System;
//using System.Collections.Generic;
//using System.Text;
//using System.Threading;
//using System.Threading.Tasks;
//using DotNetCore.CAP.Infrastructure;
//using DotNetCore.CAP.Processor;
//using Microsoft.Extensions.DependencyInjection;
//using Moq;
//using Xunit;
//namespace DotNetCore.CAP.Test.Job
//{
// public class JobProcessingServerTest
// {
// private CancellationTokenSource _cancellationTokenSource;
// private ProcessingContext _context;
// private CapOptions _options;
// private IServiceProvider _provider;
// private Mock<ICapMessageStore> _mockStorage;
// public JobProcessingServerTest()
// {
// _options = new CapOptions()
// {
// PollingDelay = 0
// };
// _mockStorage = new Mock<ICapMessageStore>();
// _cancellationTokenSource = new CancellationTokenSource();
// var services = new ServiceCollection();
// services.AddTransient<JobProcessingServer>();
// // services.AddTransient<DefaultCronJobRegistry>();
// services.AddLogging();
// services.AddSingleton(_options);
// services.AddSingleton(_mockStorage.Object);
// _provider = services.BuildServiceProvider();
// _context = new ProcessingContext(_provider, _cancellationTokenSource.Token);
// }
// //[Fact]
// //public async Task ProcessAsync_CancellationTokenCancelled_ThrowsImmediately()
// //{
// // // Arrange
// // _cancellationTokenSource.Cancel();
// // var fixture = Create();
// // // Act
// // await Assert.ThrowsAsync<OperationCanceledException>(() => fixture.s(_context));
// //}
// //[Fact]
// //public async Task ProcessAsync()
// //{
// // // Arrange
// // var job = new CronJob(
// // InvocationData.Serialize(
// // MethodInvocation.FromExpression(() => Method())).Serialize());
// // var mockFetchedJob = Mock.Get(Mock.Of<IFetchedJob>(fj => fj.JobId == 42));
// // _mockStorageConnection
// // .Setup(m => m.FetchNextJobAsync())
// // .ReturnsAsync(mockFetchedJob.Object).Verifiable();
// // _mockStorageConnection
// // .Setup(m => m.GetJobAsync(42))
// // .ReturnsAsync(job).Verifiable();
// // var fixture = Create();
// // // Act
// // fixture.Start();
// // // Assert
// // _mockStorageConnection.VerifyAll();
// // _mockStateChanger.Verify(m => m.ChangeState(job, It.IsAny<SucceededState>(), It.IsAny<IStorageTransaction>()));
// // mockFetchedJob.Verify(m => m.Requeue(), Times.Never);
// // mockFetchedJob.Verify(m => m.RemoveFromQueue());
// //}
// //[Fact]
// //public async Task ProcessAsync_Exception()
// //{
// // // Arrange
// // var job = new Job(
// // InvocationData.Serialize(
// // MethodInvocation.FromExpression(() => Throw())).Serialize());
// // var mockFetchedJob = Mock.Get(Mock.Of<IFetchedJob>(fj => fj.JobId == 42));
// // _mockStorageConnection
// // .Setup(m => m.FetchNextJobAsync())
// // .ReturnsAsync(mockFetchedJob.Object);
// // _mockStorageConnection
// // .Setup(m => m.GetJobAsync(42))
// // .ReturnsAsync(job);
// // _mockStateChanger.Setup(m => m.ChangeState(job, It.IsAny<IState>(), It.IsAny<IStorageTransaction>()))
// // .Throws<Exception>();
// // var fixture = Create();
// // // Act
// // await fixture.ProcessAsync(_context);
// // // Assert
// // job.Retries.Should().Be(0);
// // mockFetchedJob.Verify(m => m.Requeue());
// //}
// //[Fact]
// //public async Task ProcessAsync_JobThrows()
// //{
// // // Arrange
// // var job = new Job(
// // InvocationData.Serialize(
// // MethodInvocation.FromExpression(() => Throw())).Serialize());
// // var mockFetchedJob = Mock.Get(Mock.Of<IFetchedJob>(fj => fj.JobId == 42));
// // _mockStorageConnection
// // .Setup(m => m.FetchNextJobAsync())
// // .ReturnsAsync(mockFetchedJob.Object).Verifiable();
// // _mockStorageConnection
// // .Setup(m => m.GetJobAsync(42))
// // .ReturnsAsync(job).Verifiable();
// // var fixture = Create();
// // // Act
// // await fixture.ProcessAsync(_context);
// // // Assert
// // job.Retries.Should().Be(1);
// // _mockStorageTransaction.Verify(m => m.UpdateJob(job));
// // _mockStorageConnection.VerifyAll();
// // _mockStateChanger.Verify(m => m.ChangeState(job, It.IsAny<ScheduledState>(), It.IsAny<IStorageTransaction>()));
// // mockFetchedJob.Verify(m => m.RemoveFromQueue());
// //}
// //[Fact]
// //public async Task ProcessAsync_JobThrows_WithNoRetry()
// //{
// // // Arrange
// // var job = new Job(
// // InvocationData.Serialize(
// // MethodInvocation.FromExpression<NoRetryJob>(j => j.Throw())).Serialize());
// // var mockFetchedJob = Mock.Get(Mock.Of<IFetchedJob>(fj => fj.JobId == 42));
// // _mockStorageConnection
// // .Setup(m => m.FetchNextJobAsync())
// // .ReturnsAsync(mockFetchedJob.Object);
// // _mockStorageConnection
// // .Setup(m => m.GetJobAsync(42))
// // .ReturnsAsync(job);
// // var fixture = Create();
// // // Act
// // await fixture.ProcessAsync(_context);
// // // Assert
// // _mockStateChanger.Verify(m => m.ChangeState(job, It.IsAny<FailedState>(), It.IsAny<IStorageTransaction>()));
// //}
// private JobProcessingServer Create()
// => _provider.GetService<JobProcessingServer>();
// //public static void Method() { }
// //public static void Throw() { throw new Exception(); }
// //private class NoRetryJob : IRetryable
// //{
// // public RetryBehavior RetryBehavior => new RetryBehavior(false);
// // public void Throw() { throw new Exception(); }
// //}
// }
//}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment