Commit eb3d9e6f authored by yangxiaodong's avatar yangxiaodong

refactor code

parent 313b7844
...@@ -6,6 +6,9 @@ namespace Cap.Consistency.EntityFrameworkCore ...@@ -6,6 +6,9 @@ namespace Cap.Consistency.EntityFrameworkCore
{ {
public ConsistencyMessage() { public ConsistencyMessage() {
Id = Guid.NewGuid().ToString(); Id = Guid.NewGuid().ToString();
SendTime = DateTime.Now;
UpdateTime = SendTime;
Status = MessageStatus.WaitForSend;
} }
} }
......
...@@ -75,7 +75,7 @@ namespace Cap.Consistency ...@@ -75,7 +75,7 @@ namespace Cap.Consistency
/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="OperateResult"/> /// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="OperateResult"/>
/// of the operation. /// of the operation.
/// </returns> /// </returns>
public virtual Task<OperateResult> UpdateMessageAsync(TMessage message) { public virtual Task<OperateResult> UpdateAsync(TMessage message) {
ThrowIfDisposed(); ThrowIfDisposed();
//todo: validation message fileds is correct //todo: validation message fileds is correct
...@@ -90,7 +90,7 @@ namespace Cap.Consistency ...@@ -90,7 +90,7 @@ namespace Cap.Consistency
/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="OperateResult"/> /// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="OperateResult"/>
/// of the operation. /// of the operation.
/// </returns> /// </returns>
public virtual Task<OperateResult> DeleteMessageAsync(TMessage message) { public virtual Task<OperateResult> DeleteAsync(TMessage message) {
ThrowIfDisposed(); ThrowIfDisposed();
if (message == null) { if (message == null) {
......
using System; using System;
using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Internal;
namespace Cap.Consistency.EntityFrameworkCore.Test.Utilities namespace Cap.Consistency.EntityFrameworkCore.Test
{ {
public class ScratchDatabaseFixture : IDisposable public class ScratchDatabaseFixture : IDisposable
{ {
......
...@@ -68,7 +68,7 @@ namespace Cap.Consistency.Test ...@@ -68,7 +68,7 @@ namespace Cap.Consistency.Test
Assert.True(operateResult.Succeeded); Assert.True(operateResult.Succeeded);
var messageId = await manager.GetMessageIdAsync(message); var messageId = await manager.GetMessageIdAsync(message);
operateResult = await manager.DeleteMessageAsync(message); operateResult = await manager.DeleteAsync(message);
Assert.Null(await manager.FindByIdAsync(messageId)); Assert.Null(await manager.FindByIdAsync(messageId));
} }
......
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