浏览代码

clearup

master
yangxiaodong 7 年前
父节点
当前提交
2b6c54c445
共有 20 个文件被更改,包括 34 次插入76 次删除
  1. +0
    -1
      test/DotNetCore.CAP.MySql.Test/DatabaseTestHost.cs
  2. +1
    -3
      test/DotNetCore.CAP.MySql.Test/MySqlStorageConnectionTest.cs
  3. +3
    -4
      test/DotNetCore.CAP.MySql.Test/MySqlStorageTest.cs
  4. +0
    -1
      test/DotNetCore.CAP.MySql.Test/TestHost.cs
  5. +0
    -2
      test/DotNetCore.CAP.PostgreSql.Test/DatabaseTestHost.cs
  6. +1
    -3
      test/DotNetCore.CAP.PostgreSql.Test/PostgreSqlStorageConnectionTest.cs
  7. +4
    -4
      test/DotNetCore.CAP.PostgreSql.Test/PostgreSqlStorageTest.cs
  8. +1
    -1
      test/DotNetCore.CAP.PostgreSql.Test/TestHost.cs
  9. +1
    -3
      test/DotNetCore.CAP.SqlServer.Test/SqlServerStorageConnectionTest.cs
  10. +5
    -5
      test/DotNetCore.CAP.SqlServer.Test/SqlServerStorageTest.cs
  11. +1
    -1
      test/DotNetCore.CAP.SqlServer.Test/TestHost.cs
  12. +1
    -2
      test/DotNetCore.CAP.Test/CAP.BuilderTest.cs
  13. +3
    -3
      test/DotNetCore.CAP.Test/ConsumerInvokerFactoryTest.cs
  14. +1
    -4
      test/DotNetCore.CAP.Test/ConsumerServiceSelectorTest.cs
  15. +3
    -7
      test/DotNetCore.CAP.Test/ModelBinderFactoryTest.cs
  16. +5
    -9
      test/DotNetCore.CAP.Test/Processor/DefaultDispatcherTest.cs
  17. +1
    -1
      test/DotNetCore.CAP.Test/Processor/StateChangerTest.cs
  18. +1
    -6
      test/DotNetCore.CAP.Test/QueueExecutorFactoryTest.cs
  19. +1
    -10
      test/DotNetCore.CAP.Test/Sample.cs
  20. +1
    -6
      test/DotNetCore.CAP.Test/SubscribeFinderTest.cs

+ 0
- 1
test/DotNetCore.CAP.MySql.Test/DatabaseTestHost.cs 查看文件

@@ -1,4 +1,3 @@
using System.Data;
using System.Threading;
using Dapper;
using Microsoft.EntityFrameworkCore;


+ 1
- 3
test/DotNetCore.CAP.MySql.Test/MySqlStorageConnectionTest.cs 查看文件

@@ -85,7 +85,6 @@ namespace DotNetCore.CAP.MySql.Test
[Fact]
public async Task GetReceivedMessageAsync_Test()
{

var sql = $@"
INSERT INTO `cap.received`(`Name`,`Group`,`Content`,`Retries`,`Added`,`ExpiresAt`,`StatusName`)
VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);SELECT @@IDENTITY;";
@@ -129,6 +128,5 @@ namespace DotNetCore.CAP.MySql.Test
Assert.Equal("MySqlStorageConnectionTest", message.Name);
Assert.Equal("mygroup", message.Group);
}

}
}
}

+ 3
- 4
test/DotNetCore.CAP.MySql.Test/MySqlStorageTest.cs 查看文件

@@ -1,5 +1,5 @@
using Xunit;
using Dapper;
using Dapper;
using Xunit;

namespace DotNetCore.CAP.MySql.Test
{
@@ -9,7 +9,6 @@ namespace DotNetCore.CAP.MySql.Test
private readonly string _dbName;
private readonly string _masterDbConnectionString;


public MySqlStorageTest()
{
_dbName = ConnectionUtil.GetDatabaseName();
@@ -44,4 +43,4 @@ namespace DotNetCore.CAP.MySql.Test
}
}
}
}
}

+ 0
- 1
test/DotNetCore.CAP.MySql.Test/TestHost.cs 查看文件

@@ -1,5 +1,4 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;

namespace DotNetCore.CAP.MySql.Test


+ 0
- 2
test/DotNetCore.CAP.PostgreSql.Test/DatabaseTestHost.cs 查看文件

@@ -1,5 +1,3 @@
using System.Data;
using System.Data.SqlClient;
using System.Threading;
using Dapper;
using Microsoft.EntityFrameworkCore;


+ 1
- 3
test/DotNetCore.CAP.PostgreSql.Test/PostgreSqlStorageConnectionTest.cs 查看文件

@@ -85,7 +85,6 @@ namespace DotNetCore.CAP.PostgreSql.Test
[Fact]
public async Task GetReceivedMessageAsync_Test()
{

var sql = $@"
INSERT INTO ""cap"".""received""(""Name"",""Group"",""Content"",""Retries"",""Added"",""ExpiresAt"",""StatusName"")
VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName) RETURNING ""Id"";";
@@ -129,6 +128,5 @@ namespace DotNetCore.CAP.PostgreSql.Test
Assert.Equal("PostgreSqlStorageConnectionTest", message.Name);
Assert.Equal("mygroup", message.Group);
}

}
}
}

+ 4
- 4
test/DotNetCore.CAP.PostgreSql.Test/PostgreSqlStorageTest.cs 查看文件

@@ -1,5 +1,5 @@
using Xunit;
using Dapper;
using Dapper;
using Xunit;

namespace DotNetCore.CAP.PostgreSql.Test
{
@@ -39,9 +39,9 @@ namespace DotNetCore.CAP.PostgreSql.Test
using (var connection = ConnectionUtil.CreateConnection(_dbConnectionString))
{
var sql = $"SELECT to_regclass('{tableName}') is not null;";
var result = connection.QueryFirstOrDefault<bool>(sql);
var result = connection.QueryFirstOrDefault<bool>(sql);
Assert.True(result);
}
}
}
}
}

+ 1
- 1
test/DotNetCore.CAP.PostgreSql.Test/TestHost.cs 查看文件

@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.PostgreSql.Test

_connectionString = ConnectionUtil.GetConnectionString();
services.AddSingleton(new PostgreSqlOptions { ConnectionString = _connectionString });
services.AddSingleton<PostgreSqlStorage>();
services.AddSingleton<PostgreSqlStorage>();

_services = services;
}


+ 1
- 3
test/DotNetCore.CAP.SqlServer.Test/SqlServerStorageConnectionTest.cs 查看文件

@@ -85,7 +85,6 @@ namespace DotNetCore.CAP.SqlServer.Test
[Fact]
public async Task GetReceivedMessageAsync_Test()
{

var sql = $@"
INSERT INTO [Cap].[Received]([Name],[Group],[Content],[Retries],[Added],[ExpiresAt],[StatusName]) OUTPUT INSERTED.Id
VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
@@ -129,6 +128,5 @@ namespace DotNetCore.CAP.SqlServer.Test
Assert.Equal("SqlServerStorageConnectionTest", message.Name);
Assert.Equal("mygroup", message.Group);
}

}
}
}

+ 5
- 5
test/DotNetCore.CAP.SqlServer.Test/SqlServerStorageTest.cs 查看文件

@@ -1,5 +1,5 @@
using Xunit;
using Dapper;
using Dapper;
using Xunit;

namespace DotNetCore.CAP.SqlServer.Test
{
@@ -14,7 +14,7 @@ namespace DotNetCore.CAP.SqlServer.Test
{
var databaseName = ConnectionUtil.GetDatabaseName();
var sql = $@"
IF EXISTS (SELECT * FROM sysdatabases WHERE name = N'{databaseName}')
IF EXISTS (SELECT * FROM sysdatabases WHERE name = N'{databaseName}')
SELECT 'True'
ELSE
SELECT 'False'";
@@ -39,6 +39,6 @@ SELECT 'False'";
var result = connection.QueryFirst<bool>(sql);
Assert.True(result);
}
}
}
}
}
}

+ 1
- 1
test/DotNetCore.CAP.SqlServer.Test/TestHost.cs 查看文件

@@ -29,7 +29,7 @@ namespace DotNetCore.CAP.SqlServer.Test

_connectionString = ConnectionUtil.GetConnectionString();
services.AddSingleton(new SqlServerOptions { ConnectionString = _connectionString });
services.AddSingleton<SqlServerStorage>();
services.AddSingleton<SqlServerStorage>();

_services = services;
}


+ 1
- 2
test/DotNetCore.CAP.Test/CAP.BuilderTest.cs 查看文件

@@ -1,8 +1,8 @@
using System;
using System.Data;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using System.Data;

namespace DotNetCore.CAP.Test
{
@@ -36,7 +36,6 @@ namespace DotNetCore.CAP.Test
Assert.NotNull(markService);
}


[Fact]
public void CanOverridePublishService()
{


+ 3
- 3
test/DotNetCore.CAP.Test/ConsumerInvokerFactoryTest.cs 查看文件

@@ -11,7 +11,7 @@ namespace DotNetCore.CAP.Test
{
public class ConsumerInvokerFactoryTest
{
IConsumerInvokerFactory consumerInvokerFactory;
private IConsumerInvokerFactory consumerInvokerFactory;

public ConsumerInvokerFactoryTest()
{
@@ -67,6 +67,6 @@ namespace DotNetCore.CAP.Test
{
await invoker.InvokeAsync();
});
}
}
}
}
}

+ 1
- 4
test/DotNetCore.CAP.Test/ConsumerServiceSelectorTest.cs 查看文件

@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using DotNetCore.CAP.Abstractions;
using DotNetCore.CAP.Internal;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

@@ -20,7 +17,7 @@ namespace DotNetCore.CAP.Test
services.AddScoped<IFooTest, CandidatesFooTest>();
services.AddScoped<IBarTest, CandidatesBarTest>();
services.AddLogging();
services.AddCap(x=> { });
services.AddCap(x => { });
_provider = services.BuildServiceProvider();
}



+ 3
- 7
test/DotNetCore.CAP.Test/ModelBinderFactoryTest.cs 查看文件

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Linq;
using System.Reflection;
using DotNetCore.CAP.Internal;
using Xunit;
@@ -10,7 +7,7 @@ namespace DotNetCore.CAP.Test
{
public class ModelBinderFactoryTest
{
IModelBinderFactory _factory;
private IModelBinderFactory _factory;

public ModelBinderFactoryTest()
{
@@ -42,6 +39,5 @@ namespace DotNetCore.CAP.Test
Assert.False(binder is SimpleTypeModelBinder);
Assert.True(binder is ComplexTypeModelBinder);
}

}
}
}

+ 5
- 9
test/DotNetCore.CAP.Test/Processor/DefaultDispatcherTest.cs 查看文件

@@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Models;
using DotNetCore.CAP.Processor;
using DotNetCore.CAP.Processor.States;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Moq;
@@ -64,12 +60,12 @@ namespace DotNetCore.CAP.Test
public async Task ProcessAsync()
{
// Arrange
var job = new CapPublishedMessage {
var job = new CapPublishedMessage
{
};

var mockFetchedJob = Mock.Get(Mock.Of<IFetchedMessage>(fj => fj.MessageId == 42 && fj.MessageType == MessageType.Publish ));
var mockFetchedJob = Mock.Get(Mock.Of<IFetchedMessage>(fj => fj.MessageId == 42 && fj.MessageType == MessageType.Publish));
_mockStorageConnection
.Setup(m => m.FetchNextMessageAsync())
.ReturnsAsync(mockFetchedJob.Object).Verifiable();
@@ -84,7 +80,7 @@ namespace DotNetCore.CAP.Test
await fixture.ProcessAsync(_context);

// Assert
_mockStorageConnection.VerifyAll();
_mockStorageConnection.VerifyAll();
}

private DefaultDispatcher Create()


+ 1
- 1
test/DotNetCore.CAP.Test/Processor/StateChangerTest.cs 查看文件

@@ -56,4 +56,4 @@ namespace DotNetCore.CAP.Test

private StateChanger Create() => new StateChanger();
}
}
}

+ 1
- 6
test/DotNetCore.CAP.Test/QueueExecutorFactoryTest.cs 查看文件

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

@@ -41,8 +39,5 @@ namespace DotNetCore.CAP.Test
var publishExecutor = queueExecutorFactory.GetInstance(Models.MessageType.Publish);
Assert.Null(publishExecutor);
}



}
}
}

+ 1
- 10
test/DotNetCore.CAP.Test/Sample.cs 查看文件

@@ -1,41 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace DotNetCore.CAP.Test
{
public class Sample
{

public void DateTimeParam(DateTime dateTime)
{

}

public void StringParam(string @string)
{

}

public void GuidParam(Guid guid)
{

}

public void UriParam(Uri uri)
{

}

public void IntegerParam(int @int)
{

}

public void ComplexTypeParam(ComplexType complexType)
{

}

public void ThrowException()
@@ -67,4 +58,4 @@ namespace DotNetCore.CAP.Test

public string Name { get; set; }
}
}
}

+ 1
- 6
test/DotNetCore.CAP.Test/SubscribeFinderTest.cs 查看文件

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using DotNetCore.CAP.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
@@ -22,7 +20,6 @@ namespace DotNetCore.CAP.Test
[Fact]
public void CanFindControllers()
{
}

[Fact]
@@ -36,7 +33,6 @@ namespace DotNetCore.CAP.Test

public class HomeController
{

}

public interface ITestService { }
@@ -46,7 +42,6 @@ namespace DotNetCore.CAP.Test
[CapSubscribe("test")]
public void Index()
{

}
}

@@ -56,4 +51,4 @@ namespace DotNetCore.CAP.Test
{
}
}
}
}

正在加载...
取消
保存