Browse Source

remove unused file.

master
Savorboard 7 years ago
parent
commit
bb12438486
3 changed files with 0 additions and 159 deletions
  1. +0
    -113
      test/Shared/MessageManagerTestBase.cs
  2. +0
    -6
      test/Shared/TestConsistencyMessage.cs
  3. +0
    -40
      test/Shared/TestLogger.cs

+ 0
- 113
test/Shared/MessageManagerTestBase.cs View File

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

+ 0
- 6
test/Shared/TestConsistencyMessage.cs View File

@@ -1,6 +0,0 @@
using System;
using DotNetCore.CAP.Infrastructure;

namespace DotNetCore.CAP.Test
{
}

+ 0
- 40
test/Shared/TestLogger.cs View File

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

Loading…
Cancel
Save