Commit 03ca87c0 authored by yangxiaodong's avatar yangxiaodong

Update Tests.

parent 1a35a8b0
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; }
}
}
\ No newline at end of file
......@@ -18,14 +18,14 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test
{
Id = guid,
Content = "this is message body",
StateName = StateName.Enqueued
StatusName = StatusName.Enqueued
};
db.Attach(message).State = Microsoft.EntityFrameworkCore.EntityState.Added;
db.SaveChanges();
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
{
[DbContext(typeof(TestDbContext))]
[Migration("20170628102530_Init")]
partial class Init
[Migration("20170629074320_InitCreate")]
partial class InitCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
......@@ -32,7 +32,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
b.Property<int>("Retries");
b.Property<string>("StateName")
b.Property<string>("StatusName")
.HasMaxLength(50);
b.HasKey("Id");
......@@ -55,7 +55,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
b.Property<int>("Retries");
b.Property<string>("StateName")
b.Property<string>("StatusName")
.HasMaxLength(50);
b.HasKey("Id");
......
......@@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
{
public partial class Init : Migration
public partial class InitCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
......@@ -18,7 +18,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
KeyName = table.Column<string>(nullable: true),
LastRun = table.Column<DateTime>(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 =>
{
......@@ -35,7 +35,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
KeyName = table.Column<string>(nullable: true),
LastRun = table.Column<DateTime>(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 =>
{
......
......@@ -31,7 +31,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
b.Property<int>("Retries");
b.Property<string>("StateName")
b.Property<string>("StatusName")
.HasMaxLength(50);
b.HasKey("Id");
......@@ -54,7 +54,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations
b.Property<int>("Retries");
b.Property<string>("StateName")
b.Property<string>("StatusName")
.HasMaxLength(50);
b.HasKey("Id");
......
......@@ -71,6 +71,21 @@ namespace DotNetCore.CAP.Test
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()
{
throw new NotImplementedException();
......
......@@ -7,6 +7,21 @@ namespace DotNetCore.CAP.Test
{
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()
{
throw new NotImplementedException();
......
......@@ -84,7 +84,7 @@ namespace DotNetCore.CAP.Test
Assert.NotNull(operateResult);
Assert.True(operateResult.Succeeded);
message.StateName = StateName.Processing;
message.StatusName = StatusName.Processing;
operateResult = await manager.UpdateReceivedMessageAsync(message);
Assert.NotNull(operateResult);
Assert.True(operateResult.Succeeded);
......
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