Commit bb124384 authored by Savorboard's avatar Savorboard

remove unused file.

parent a4ec4773
//using System;
//using System.Threading.Tasks;
//using DotNetCore.CAP.Infrastructure;
//using DotNetCore.CAP.Models;
//using Microsoft.AspNetCore.Http;
//using Microsoft.Extensions.DependencyInjection;
//using Microsoft.Extensions.Logging;
//using Xunit;
//namespace DotNetCore.CAP.Test
//{
// public abstract class MessageManagerTestBase
// {
// private const string NullValue = "(null)";
// protected virtual bool ShouldSkipDbTests()
// {
// return false;
// }
// protected virtual void SetupMessageServices(IServiceCollection services, object context = null)
// {
// services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
// services.AddCap();
// AddMessageStore(services, context);
// services.AddSingleton<ILogger<ICapMessageStore>>(new TestLogger<ICapMessageStore>());
// }
// protected virtual ICapMessageStore CreateManager(object context = null, IServiceCollection services = null,
// Action<IServiceCollection> configureServices = null)
// {
// if (services == null)
// {
// services = new ServiceCollection();
// }
// if (context == null)
// {
// context = CreateTestContext();
// }
// SetupMessageServices(services, context);
// configureServices?.Invoke(services);
// return services.BuildServiceProvider().GetService<ICapMessageStore>();
// }
// protected abstract object CreateTestContext();
// protected abstract CapSentMessage CreateTestSentMessage(string content = "");
// protected abstract CapReceivedMessage CreateTestReceivedMessage(string content = "");
// protected abstract void AddMessageStore(IServiceCollection services, object context = null);
// [Fact]
// public async Task CanDeleteSentMessage()
// {
// if (ShouldSkipDbTests())
// {
// return;
// }
// var manager = CreateManager();
// var message = CreateTestSentMessage();
// var operateResult = await manager.StoreSentMessageAsync(message);
// Assert.NotNull(operateResult);
// Assert.True(operateResult.Succeeded);
// // operateResult = await manager.RemoveSentMessageAsync(message);
// // Assert.NotNull(operateResult);
// // Assert.True(operateResult.Succeeded);
// }
// //[Fact]
// //public async Task CanUpdateReceivedMessage()
// //{
// // if (ShouldSkipDbTests())
// // {
// // return;
// // }
// // var manager = CreateManager();
// // var message = CreateTestReceivedMessage();
// // // var operateResult = await manager.StoreReceivedMessageAsync(message);
// // // Assert.NotNull(operateResult);
// // // Assert.True(operateResult.Succeeded);
// // // message.StatusName = StatusName.Processing;
// // // operateResult = await manager.UpdateReceivedMessageAsync(message);
// // // Assert.NotNull(operateResult);
// // // Assert.True(operateResult.Succeeded);
// //}
// [Fact]
// public async Task CanGetNextSendMessage()
// {
// if (ShouldSkipDbTests())
// {
// return;
// }
// var manager = CreateManager();
// var message = CreateTestSentMessage();
// var operateResult = await manager.StoreSentMessageAsync(message);
// Assert.NotNull(operateResult);
// Assert.True(operateResult.Succeeded);
// // var storeMessage = await manager.GetNextSentMessageToBeEnqueuedAsync();
// // Assert.Equal(message, storeMessage);
// }
// }
//}
\ No newline at end of file
using System;
using DotNetCore.CAP.Infrastructure;
namespace DotNetCore.CAP.Test
{
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP.Test
{
public interface ITestLogger
{
IList<string> LogMessages { get; }
}
public class TestLogger<TName> : ILogger<TName>, ITestLogger
{
public IList<string> LogMessages { get; } = new List<string>();
public IDisposable BeginScope<TState>(TState state)
{
LogMessages.Add(state?.ToString());
return null;
}
public bool IsEnabled(LogLevel logLevel)
{
return true;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception,
Func<TState, Exception, string> formatter)
{
if (formatter == null)
{
LogMessages.Add(state.ToString());
}
else
{
LogMessages.Add(formatter(state, exception));
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment