@@ -4,7 +4,7 @@ environment: | |||||
BUILDING_ON_PLATFORM: win | BUILDING_ON_PLATFORM: win | ||||
BuildEnvironment: appveyor | BuildEnvironment: appveyor | ||||
Cap_SqlServer_ConnectionStringTemplate: Server=(local)\SQL2014;Database={0};User ID=sa;Password=Password12! | Cap_SqlServer_ConnectionStringTemplate: Server=(local)\SQL2014;Database={0};User ID=sa;Password=Password12! | ||||
Cap_MySql_ConnectionStringTemplate: Server=localhost;Database={0};Uid=root;Pwd=Password12! | |||||
Cap_MySql_ConnectionStringTemplate: Server=localhost;Database={0};Uid=root;Pwd=Password12!;Allow User Variables=True | |||||
Cap_PostgreSql_ConnectionStringTemplate: Server=localhost;Database={0};UserId=postgres;Password=Password12! | Cap_PostgreSql_ConnectionStringTemplate: Server=localhost;Database={0};UserId=postgres;Password=Password12! | ||||
services: | services: | ||||
- mssql2014 | - mssql2014 | ||||
@@ -10,7 +10,7 @@ namespace Sample.RabbitMQ.MySql | |||||
{ | { | ||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||||
{ | { | ||||
optionsBuilder.UseMySql("Server=localhost;Database=Sample.RabbitMQ.MySql;UserId=root;Password=123123;"); | |||||
optionsBuilder.UseMySql("Server=localhost;Database=Sample.RabbitMQ.MySql;UserId=root;Password=123123;Allow User Variables=True"); | |||||
//optionsBuilder.UseMySql("Server=192.168.2.206;Database=Sample.RabbitMQ.MySql;UserId=root;Password=123123;"); | //optionsBuilder.UseMySql("Server=192.168.2.206;Database=Sample.RabbitMQ.MySql;UserId=root;Password=123123;"); | ||||
} | } | ||||
} | } | ||||
@@ -41,8 +41,8 @@ namespace DotNetCore.CAP.MySql | |||||
public Task<IFetchedMessage> FetchNextMessageAsync() | public Task<IFetchedMessage> FetchNextMessageAsync() | ||||
{ | { | ||||
var sql = $@" | var sql = $@" | ||||
SELECT @MessageId:=`MessageId` as MessageId, @MessageType:=`MessageType` as MessageType FROM `{_prefix}.queue` LIMIT 1; | |||||
DELETE FROM `{_prefix}.queue` where `MessageId` = @MessageId AND `MessageType`=@MessageType;"; | |||||
SELECT @MId:=`MessageId` as MessageId, @MType:=`MessageType` as MessageType FROM `{_prefix}.queue` LIMIT 1; | |||||
DELETE FROM `{_prefix}.queue` where `MessageId` = @MId AND `MessageType`=@MType;"; | |||||
return FetchNextMessageCoreAsync(sql); | return FetchNextMessageCoreAsync(sql); | ||||
} | } | ||||
@@ -12,7 +12,7 @@ namespace DotNetCore.CAP.MySql.Test | |||||
private const string DefaultDatabaseName = @"DotNetCore.CAP.MySql.Test"; | private const string DefaultDatabaseName = @"DotNetCore.CAP.MySql.Test"; | ||||
private const string DefaultConnectionStringTemplate = | private const string DefaultConnectionStringTemplate = | ||||
@"Server=localhost;Database={0};Uid=root;Pwd=123123;"; | |||||
@"Server=localhost;Database={0};Uid=root;Pwd=123123;Allow User Variables=True;"; | |||||
public static string GetDatabaseName() | public static string GetDatabaseName() | ||||
{ | { | ||||
@@ -52,11 +52,12 @@ namespace DotNetCore.CAP.MySql.Test | |||||
{ | { | ||||
connection.Execute(sql, queue); | connection.Execute(sql, queue); | ||||
} | } | ||||
var fetchedMessage = await _storage.FetchNextMessageAsync(); | |||||
fetchedMessage.Dispose(); | |||||
Assert.NotNull(fetchedMessage); | |||||
Assert.Equal(MessageType.Publish, fetchedMessage.MessageType); | |||||
Assert.Equal(3333, fetchedMessage.MessageId); | |||||
using (var fetchedMessage = await _storage.FetchNextMessageAsync()) | |||||
{ | |||||
Assert.NotNull(fetchedMessage); | |||||
Assert.Equal(MessageType.Publish, fetchedMessage.MessageType); | |||||
Assert.Equal(3333, fetchedMessage.MessageId); | |||||
} | |||||
} | } | ||||
[Fact] | [Fact] | ||||
@@ -48,7 +48,7 @@ namespace DotNetCore.CAP.Test | |||||
[Theory] | [Theory] | ||||
[InlineData(nameof(Sample.ThrowException))] | [InlineData(nameof(Sample.ThrowException))] | ||||
[InlineData(nameof(Sample.AsyncMethod))] | [InlineData(nameof(Sample.AsyncMethod))] | ||||
public async void InvokeMethodTest(string methodName) | |||||
public void InvokeMethodTest(string methodName) | |||||
{ | { | ||||
var methodInfo = typeof(Sample).GetRuntimeMethods() | var methodInfo = typeof(Sample).GetRuntimeMethods() | ||||
.Single(x => x.Name == methodName); | .Single(x => x.Name == methodName); | ||||
@@ -64,10 +64,10 @@ namespace DotNetCore.CAP.Test | |||||
var invoker = consumerInvokerFactory.CreateInvoker(context); | var invoker = consumerInvokerFactory.CreateInvoker(context); | ||||
await Assert.ThrowsAsync(typeof(Exception), async () => | |||||
Assert.Throws<Exception>(() => | |||||
{ | { | ||||
await invoker.InvokeAsync(); | |||||
}); | |||||
invoker.InvokeAsync().GetAwaiter().GetResult(); | |||||
}); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -11,7 +11,7 @@ namespace DotNetCore.CAP.Test | |||||
var result = new OperateResult(); | var result = new OperateResult(); | ||||
Assert.False(result.Succeeded); | Assert.False(result.Succeeded); | ||||
Assert.Equal(0, result.Errors.Count()); | |||||
Assert.Empty(result.Errors); | |||||
} | } | ||||
[Fact] | [Fact] | ||||
@@ -20,7 +20,7 @@ namespace DotNetCore.CAP.Test | |||||
var result = OperateResult.Failed(); | var result = OperateResult.Failed(); | ||||
Assert.False(result.Succeeded); | Assert.False(result.Succeeded); | ||||
Assert.Equal(0, result.Errors.Count()); | |||||
Assert.Empty(result.Errors); | |||||
} | } | ||||
} | } | ||||
} | } |