Browse Source

refactor code

master
yangxiaodong 7 years ago
parent
commit
eb3d9e6f8a
4 changed files with 7 additions and 4 deletions
  1. +3
    -0
      src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs
  2. +2
    -2
      src/Cap.Consistency/ConsistencyMessageManager.cs
  3. +1
    -1
      test/Cap.Consistency.EntityFrameworkCore.Test/Utilities/ScratchDatabaseFixture.cs
  4. +1
    -1
      test/Shared/MessageManagerTestBase.cs

+ 3
- 0
src/Cap.Consistency.EntityFrameworkCore/ConsistencyMessage.cs View File

@@ -6,6 +6,9 @@ namespace Cap.Consistency.EntityFrameworkCore
{
public ConsistencyMessage() {
Id = Guid.NewGuid().ToString();
SendTime = DateTime.Now;
UpdateTime = SendTime;
Status = MessageStatus.WaitForSend;
}
}



+ 2
- 2
src/Cap.Consistency/ConsistencyMessageManager.cs View File

@@ -75,7 +75,7 @@ namespace Cap.Consistency
/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="OperateResult"/>
/// of the operation.
/// </returns>
public virtual Task<OperateResult> UpdateMessageAsync(TMessage message) {
public virtual Task<OperateResult> UpdateAsync(TMessage message) {
ThrowIfDisposed();
//todo: validation message fileds is correct

@@ -90,7 +90,7 @@ namespace Cap.Consistency
/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="OperateResult"/>
/// of the operation.
/// </returns>
public virtual Task<OperateResult> DeleteMessageAsync(TMessage message) {
public virtual Task<OperateResult> DeleteAsync(TMessage message) {
ThrowIfDisposed();

if (message == null) {


+ 1
- 1
test/Cap.Consistency.EntityFrameworkCore.Test/Utilities/ScratchDatabaseFixture.cs View File

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


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

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



Loading…
Cancel
Save