Browse Source

Update Tests.

master
yangxiaodong 7 years ago
parent
commit
03ca87c0fc
8 changed files with 42 additions and 34 deletions
  1. +0
    -22
      src/DotNetCore.CAP/CapStartContext.cs
  2. +2
    -2
      test/DotNetCore.CAP.EntityFrameworkCore.Test/MessageStoreTest.cs
  3. +4
    -4
      test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.Designer.cs
  4. +3
    -3
      test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.cs
  5. +2
    -2
      test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/TestDbContextModelSnapshot.cs
  6. +15
    -0
      test/DotNetCore.CAP.Test/CAP.BuilderTest.cs
  7. +15
    -0
      test/DotNetCore.CAP.Test/NoopMessageStore.cs
  8. +1
    -1
      test/Shared/MessageManagerTestBase.cs

+ 0
- 22
src/DotNetCore.CAP/CapStartContext.cs View File

@@ -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; }
}
}

+ 2
- 2
test/DotNetCore.CAP.EntityFrameworkCore.Test/MessageStoreTest.cs View 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));
}
}



test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.Designer.cs → test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.Designer.cs View File

@@ -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");

test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170628102530_Init.cs → test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/20170629074320_InitCreate.cs View File

@@ -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 =>
{

+ 2
- 2
test/DotNetCore.CAP.EntityFrameworkCore.Test/Migrations/TestDbContextModelSnapshot.cs View File

@@ -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");


+ 15
- 0
test/DotNetCore.CAP.Test/CAP.BuilderTest.cs View File

@@ -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();


+ 15
- 0
test/DotNetCore.CAP.Test/NoopMessageStore.cs View File

@@ -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();


+ 1
- 1
test/Shared/MessageManagerTestBase.cs View File

@@ -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);


Loading…
Cancel
Save