@@ -1,22 +0,0 @@ | |||||
using System; | |||||
using System.Threading; | |||||
namespace DotNetCore.CAP | |||||
{ | |||||
public class CapStartContext | |||||
{ | |||||
public CapStartContext() | |||||
{ | |||||
} | |||||
public CapStartContext(IServiceProvider provider, CancellationToken cancellationToken) | |||||
{ | |||||
ServiceProvider = provider; | |||||
CancellationToken = cancellationToken; | |||||
} | |||||
public IServiceProvider ServiceProvider { get; set; } | |||||
public CancellationToken CancellationToken { get; } | |||||
} | |||||
} |
@@ -18,14 +18,14 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test | |||||
{ | { | ||||
Id = guid, | Id = guid, | ||||
Content = "this is message body", | Content = "this is message body", | ||||
StateName = StateName.Enqueued | |||||
StatusName = StatusName.Enqueued | |||||
}; | }; | ||||
db.Attach(message).State = Microsoft.EntityFrameworkCore.EntityState.Added; | db.Attach(message).State = Microsoft.EntityFrameworkCore.EntityState.Added; | ||||
db.SaveChanges(); | db.SaveChanges(); | ||||
Assert.True(db.CapSentMessages.Any(u => u.Id == guid)); | Assert.True(db.CapSentMessages.Any(u => u.Id == guid)); | ||||
Assert.NotNull(db.CapSentMessages.FirstOrDefault(u => u.StateName == StateName.Enqueued)); | |||||
Assert.NotNull(db.CapSentMessages.FirstOrDefault(u => u.StatusName == StatusName.Enqueued)); | |||||
} | } | ||||
} | } | ||||
@@ -8,8 +8,8 @@ using DotNetCore.CAP.EntityFrameworkCore.Test; | |||||
namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | ||||
{ | { | ||||
[DbContext(typeof(TestDbContext))] | [DbContext(typeof(TestDbContext))] | ||||
[Migration("20170628102530_Init")] | |||||
partial class Init | |||||
[Migration("20170629074320_InitCreate")] | |||||
partial class InitCreate | |||||
{ | { | ||||
protected override void BuildTargetModel(ModelBuilder modelBuilder) | protected override void BuildTargetModel(ModelBuilder modelBuilder) | ||||
{ | { | ||||
@@ -32,7 +32,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||||
b.Property<int>("Retries"); | b.Property<int>("Retries"); | ||||
b.Property<string>("StateName") | |||||
b.Property<string>("StatusName") | |||||
.HasMaxLength(50); | .HasMaxLength(50); | ||||
b.HasKey("Id"); | b.HasKey("Id"); | ||||
@@ -55,7 +55,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||||
b.Property<int>("Retries"); | b.Property<int>("Retries"); | ||||
b.Property<string>("StateName") | |||||
b.Property<string>("StatusName") | |||||
.HasMaxLength(50); | .HasMaxLength(50); | ||||
b.HasKey("Id"); | b.HasKey("Id"); |
@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations; | |||||
namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | ||||
{ | { | ||||
public partial class Init : Migration | |||||
public partial class InitCreate : Migration | |||||
{ | { | ||||
protected override void Up(MigrationBuilder migrationBuilder) | protected override void Up(MigrationBuilder migrationBuilder) | ||||
{ | { | ||||
@@ -18,7 +18,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||||
KeyName = table.Column<string>(nullable: true), | KeyName = table.Column<string>(nullable: true), | ||||
LastRun = table.Column<DateTime>(nullable: false), | LastRun = table.Column<DateTime>(nullable: false), | ||||
Retries = table.Column<int>(nullable: false), | Retries = table.Column<int>(nullable: false), | ||||
StateName = table.Column<string>(maxLength: 50, nullable: true) | |||||
StatusName = table.Column<string>(maxLength: 50, nullable: true) | |||||
}, | }, | ||||
constraints: table => | constraints: table => | ||||
{ | { | ||||
@@ -35,7 +35,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||||
KeyName = table.Column<string>(nullable: true), | KeyName = table.Column<string>(nullable: true), | ||||
LastRun = table.Column<DateTime>(nullable: false), | LastRun = table.Column<DateTime>(nullable: false), | ||||
Retries = table.Column<int>(nullable: false), | Retries = table.Column<int>(nullable: false), | ||||
StateName = table.Column<string>(maxLength: 50, nullable: true) | |||||
StatusName = table.Column<string>(maxLength: 50, nullable: true) | |||||
}, | }, | ||||
constraints: table => | constraints: table => | ||||
{ | { |
@@ -31,7 +31,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||||
b.Property<int>("Retries"); | b.Property<int>("Retries"); | ||||
b.Property<string>("StateName") | |||||
b.Property<string>("StatusName") | |||||
.HasMaxLength(50); | .HasMaxLength(50); | ||||
b.HasKey("Id"); | b.HasKey("Id"); | ||||
@@ -54,7 +54,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations | |||||
b.Property<int>("Retries"); | b.Property<int>("Retries"); | ||||
b.Property<string>("StateName") | |||||
b.Property<string>("StatusName") | |||||
.HasMaxLength(50); | .HasMaxLength(50); | ||||
b.HasKey("Id"); | b.HasKey("Id"); | ||||
@@ -71,6 +71,21 @@ namespace DotNetCore.CAP.Test | |||||
private class MyMessageStore : ICapMessageStore | private class MyMessageStore : ICapMessageStore | ||||
{ | { | ||||
public Task<OperateResult> ChangeReceivedMessageStateAsync(CapReceivedMessage message, string statusName, bool autoSaveChanges = true) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Task<OperateResult> ChangeSentMessageStateAsync(CapSentMessage message, string statusName, bool autoSaveChanges = true) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Task<CapReceivedMessage> GetNextReceivedMessageToBeExcuted() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Task<CapSentMessage> GetNextSentMessageToBeEnqueuedAsync() | public Task<CapSentMessage> GetNextSentMessageToBeEnqueuedAsync() | ||||
{ | { | ||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
@@ -7,6 +7,21 @@ namespace DotNetCore.CAP.Test | |||||
{ | { | ||||
public class NoopMessageStore : ICapMessageStore | public class NoopMessageStore : ICapMessageStore | ||||
{ | { | ||||
public Task<OperateResult> ChangeReceivedMessageStateAsync(CapReceivedMessage message, string statusName, bool autoSaveChanges = true) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Task<OperateResult> ChangeSentMessageStateAsync(CapSentMessage message, string statusName, bool autoSaveChanges = true) | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Task<CapReceivedMessage> GetNextReceivedMessageToBeExcuted() | |||||
{ | |||||
throw new NotImplementedException(); | |||||
} | |||||
public Task<CapSentMessage> GetNextSentMessageToBeEnqueuedAsync() | public Task<CapSentMessage> GetNextSentMessageToBeEnqueuedAsync() | ||||
{ | { | ||||
throw new NotImplementedException(); | throw new NotImplementedException(); | ||||
@@ -84,7 +84,7 @@ namespace DotNetCore.CAP.Test | |||||
Assert.NotNull(operateResult); | Assert.NotNull(operateResult); | ||||
Assert.True(operateResult.Succeeded); | Assert.True(operateResult.Succeeded); | ||||
message.StateName = StateName.Processing; | |||||
message.StatusName = StatusName.Processing; | |||||
operateResult = await manager.UpdateReceivedMessageAsync(message); | operateResult = await manager.UpdateReceivedMessageAsync(message); | ||||
Assert.NotNull(operateResult); | Assert.NotNull(operateResult); | ||||
Assert.True(operateResult.Succeeded); | Assert.True(operateResult.Succeeded); | ||||