25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.8 KiB

  1. using Microsoft.Extensions.DependencyInjection;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using Xunit;
  7. using System.Threading;
  8. namespace Cap.Consistency.Test
  9. {
  10. public class ConsistencyBuilderTest
  11. {
  12. [Fact]
  13. public void CanOverrideMessageStore() {
  14. var services = new ServiceCollection();
  15. services.AddConsistency<TestConsistencyMessage>().AddMessageStore<MyUberThingy>();
  16. var thingy = services.BuildServiceProvider().GetRequiredService<IConsistencyMessageStore<TestConsistencyMessage>>() as MyUberThingy;
  17. Assert.NotNull(thingy);
  18. }
  19. private class MyUberThingy : IConsistencyMessageStore<TestConsistencyMessage>
  20. {
  21. public Task<OperateResult> CreateAsync(TestConsistencyMessage message, CancellationToken cancellationToken) {
  22. throw new NotImplementedException();
  23. }
  24. public Task<OperateResult> DeleteAsync(TestConsistencyMessage message, CancellationToken cancellationToken) {
  25. throw new NotImplementedException();
  26. }
  27. public void Dispose() {
  28. throw new NotImplementedException();
  29. }
  30. public Task<TestConsistencyMessage> FindByIdAsync(string messageId, CancellationToken cancellationToken) {
  31. throw new NotImplementedException();
  32. }
  33. public Task<string> GetMessageIdAsync(TestConsistencyMessage message, CancellationToken cancellationToken) {
  34. throw new NotImplementedException();
  35. }
  36. public Task<OperateResult> UpdateAsync(TestConsistencyMessage message, CancellationToken cancellationToken) {
  37. throw new NotImplementedException();
  38. }
  39. }
  40. }
  41. }