瀏覽代碼

remove unused files.

master
yangxiaodong 7 年之前
父節點
當前提交
7a1294907e
共有 2 個檔案被更改,包括 0 行新增241 行删除
  1. +0
    -56
      test/DotNetCore.CAP.Test/Job/ComputedJobTest.cs
  2. +0
    -185
      test/DotNetCore.CAP.Test/Job/JobProcessingServerTest.cs

+ 0
- 56
test/DotNetCore.CAP.Test/Job/ComputedJobTest.cs 查看文件

@@ -1,56 +0,0 @@
//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);
// }
// }
//}

+ 0
- 185
test/DotNetCore.CAP.Test/Job/JobProcessingServerTest.cs 查看文件

@@ -1,185 +0,0 @@
//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(); }
// //}
// }
//}

Loading…
取消
儲存