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

46 lines
1.7 KiB

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