From 03ca87c0fcf9c52a1d921763e9241a529c8324e9 Mon Sep 17 00:00:00 2001 From: yangxiaodong Date: Thu, 29 Jun 2017 15:45:20 +0800 Subject: [PATCH] Update Tests. --- src/DotNetCore.CAP/CapStartContext.cs | 22 ------------------- .../MessageStoreTest.cs | 4 ++-- ... => 20170629074320_InitCreate.Designer.cs} | 8 +++---- ...0_Init.cs => 20170629074320_InitCreate.cs} | 6 ++--- .../Migrations/TestDbContextModelSnapshot.cs | 4 ++-- test/DotNetCore.CAP.Test/CAP.BuilderTest.cs | 15 +++++++++++++ test/DotNetCore.CAP.Test/NoopMessageStore.cs | 15 +++++++++++++ test/Shared/MessageManagerTestBase.cs | 2 +- 8 files changed, 42 insertions(+), 34 deletions(-) delete mode 100644 src/DotNetCore.CAP/CapStartContext.cs rename test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/{20170628102530_Init.Designer.cs => 20170629074320_InitCreate.Designer.cs} (91%) rename test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/{20170628102530_Init.cs => 20170629074320_InitCreate.cs} (89%) diff --git a/src/DotNetCore.CAP/CapStartContext.cs b/src/DotNetCore.CAP/CapStartContext.cs deleted file mode 100644 index 9b0884d..0000000 --- a/src/DotNetCore.CAP/CapStartContext.cs +++ /dev/null @@ -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; } - } -} \ No newline at end of file diff --git a/test/DotNetCore.CAP.EntityFrameworkCore.Test/MessageStoreTest.cs b/test/DotNetCore.CAP.EntityFrameworkCore.Test/MessageStoreTest.cs index f5a6831..efaf03e 100644 --- a/test/DotNetCore.CAP.EntityFrameworkCore.Test/MessageStoreTest.cs +++ b/test/DotNetCore.CAP.EntityFrameworkCore.Test/MessageStoreTest.cs @@ -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)); } } diff --git a/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.Designer.cs b/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.Designer.cs similarity index 91% rename from test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.Designer.cs rename to test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.Designer.cs index 48d601f..2079849 100644 --- a/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.Designer.cs +++ b/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.Designer.cs @@ -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("Retries"); - b.Property("StateName") + b.Property("StatusName") .HasMaxLength(50); b.HasKey("Id"); @@ -55,7 +55,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations b.Property("Retries"); - b.Property("StateName") + b.Property("StatusName") .HasMaxLength(50); b.HasKey("Id"); diff --git a/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.cs b/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.cs similarity index 89% rename from test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.cs rename to test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.cs index 4e6ad81..f7034a3 100644 --- a/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.cs +++ b/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.cs @@ -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(nullable: true), LastRun = table.Column(nullable: false), Retries = table.Column(nullable: false), - StateName = table.Column(maxLength: 50, nullable: true) + StatusName = table.Column(maxLength: 50, nullable: true) }, constraints: table => { @@ -35,7 +35,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations KeyName = table.Column(nullable: true), LastRun = table.Column(nullable: false), Retries = table.Column(nullable: false), - StateName = table.Column(maxLength: 50, nullable: true) + StatusName = table.Column(maxLength: 50, nullable: true) }, constraints: table => { diff --git a/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/TestDbContextModelSnapshot.cs b/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/TestDbContextModelSnapshot.cs index 622471c..b3d7ee1 100644 --- a/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/TestDbContextModelSnapshot.cs +++ b/test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/TestDbContextModelSnapshot.cs @@ -31,7 +31,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations b.Property("Retries"); - b.Property("StateName") + b.Property("StatusName") .HasMaxLength(50); b.HasKey("Id"); @@ -54,7 +54,7 @@ namespace DotNetCore.CAP.EntityFrameworkCore.Test.Migrations b.Property("Retries"); - b.Property("StateName") + b.Property("StatusName") .HasMaxLength(50); b.HasKey("Id"); diff --git a/test/DotNetCore.CAP.Test/CAP.BuilderTest.cs b/test/DotNetCore.CAP.Test/CAP.BuilderTest.cs index e5c41b2..9bc563a 100644 --- a/test/DotNetCore.CAP.Test/CAP.BuilderTest.cs +++ b/test/DotNetCore.CAP.Test/CAP.BuilderTest.cs @@ -71,6 +71,21 @@ namespace DotNetCore.CAP.Test private class MyMessageStore : ICapMessageStore { + public Task ChangeReceivedMessageStateAsync(CapReceivedMessage message, string statusName, bool autoSaveChanges = true) + { + throw new NotImplementedException(); + } + + public Task ChangeSentMessageStateAsync(CapSentMessage message, string statusName, bool autoSaveChanges = true) + { + throw new NotImplementedException(); + } + + public Task GetNextReceivedMessageToBeExcuted() + { + throw new NotImplementedException(); + } + public Task GetNextSentMessageToBeEnqueuedAsync() { throw new NotImplementedException(); diff --git a/test/DotNetCore.CAP.Test/NoopMessageStore.cs b/test/DotNetCore.CAP.Test/NoopMessageStore.cs index 59b62a3..0a1b7c2 100644 --- a/test/DotNetCore.CAP.Test/NoopMessageStore.cs +++ b/test/DotNetCore.CAP.Test/NoopMessageStore.cs @@ -7,6 +7,21 @@ namespace DotNetCore.CAP.Test { public class NoopMessageStore : ICapMessageStore { + public Task ChangeReceivedMessageStateAsync(CapReceivedMessage message, string statusName, bool autoSaveChanges = true) + { + throw new NotImplementedException(); + } + + public Task ChangeSentMessageStateAsync(CapSentMessage message, string statusName, bool autoSaveChanges = true) + { + throw new NotImplementedException(); + } + + public Task GetNextReceivedMessageToBeExcuted() + { + throw new NotImplementedException(); + } + public Task GetNextSentMessageToBeEnqueuedAsync() { throw new NotImplementedException(); diff --git a/test/Shared/MessageManagerTestBase.cs b/test/Shared/MessageManagerTestBase.cs index d46b93b..2825191 100644 --- a/test/Shared/MessageManagerTestBase.cs +++ b/test/Shared/MessageManagerTestBase.cs @@ -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);