From eb3d9e6f8a90ffdad9162a0201dae28911a02cd5 Mon Sep 17 00:00:00 2001 From: yangxiaodong Date: Tue, 27 Dec 2016 14:15:15 +0800 Subject: [PATCH] refactor code --- src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs | 3 +++ src/Cap.Consistency/ConsistencyMessageManager.cs | 4 ++-- .../Utilities/ScratchDatabaseFixture.cs | 2 +- test/Shared/MessageManagerTestBase.cs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs b/src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs index 8e1a07f..c69e538 100644 --- a/src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs +++ b/src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs @@ -6,6 +6,9 @@ namespace Cap.Consistency.EntityFrameworkCore { public ConsistencyMessage() { Id = Guid.NewGuid().ToString(); + SendTime = DateTime.Now; + UpdateTime = SendTime; + Status = MessageStatus.WaitForSend; } } diff --git a/src/Cap.Consistency/ConsistencyMessageManager.cs b/src/Cap.Consistency/ConsistencyMessageManager.cs index 81ee541..7bcc947 100644 --- a/src/Cap.Consistency/ConsistencyMessageManager.cs +++ b/src/Cap.Consistency/ConsistencyMessageManager.cs @@ -75,7 +75,7 @@ namespace Cap.Consistency /// The that represents the asynchronous operation, containing the /// of the operation. /// - public virtual Task UpdateMessageAsync(TMessage message) { + public virtual Task UpdateAsync(TMessage message) { ThrowIfDisposed(); //todo: validation message fileds is correct @@ -90,7 +90,7 @@ namespace Cap.Consistency /// The that represents the asynchronous operation, containing the /// of the operation. /// - public virtual Task DeleteMessageAsync(TMessage message) { + public virtual Task DeleteAsync(TMessage message) { ThrowIfDisposed(); if (message == null) { diff --git a/test/Cap.Consistency.EntityFrameworkCore.Test/Utilities/ScratchDatabaseFixture.cs b/test/Cap.Consistency.EntityFrameworkCore.Test/Utilities/ScratchDatabaseFixture.cs index f0faf92..1cb0ed9 100644 --- a/test/Cap.Consistency.EntityFrameworkCore.Test/Utilities/ScratchDatabaseFixture.cs +++ b/test/Cap.Consistency.EntityFrameworkCore.Test/Utilities/ScratchDatabaseFixture.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Internal; -namespace Cap.Consistency.EntityFrameworkCore.Test.Utilities +namespace Cap.Consistency.EntityFrameworkCore.Test { public class ScratchDatabaseFixture : IDisposable { diff --git a/test/Shared/MessageManagerTestBase.cs b/test/Shared/MessageManagerTestBase.cs index ab742b9..2ece542 100644 --- a/test/Shared/MessageManagerTestBase.cs +++ b/test/Shared/MessageManagerTestBase.cs @@ -68,7 +68,7 @@ namespace Cap.Consistency.Test Assert.True(operateResult.Succeeded); var messageId = await manager.GetMessageIdAsync(message); - operateResult = await manager.DeleteMessageAsync(message); + operateResult = await manager.DeleteAsync(message); Assert.Null(await manager.FindByIdAsync(messageId)); }