PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Framework/src/Ncqrs.Tests/Domain/AggregateRootMappedWithAttributesTests.cs

http://github.com/ncqrs/ncqrs
C# | 27 lines | 24 code | 3 blank | 0 comment | 0 complexity | 532cabc88ad2730326270d7b3a492be4 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using FluentAssertions;
  7. using Ncqrs.Domain;
  8. using Ncqrs.Eventing.Sourcing.Mapping;
  9. using Xunit;
  10. using Rhino.Mocks;
  11. namespace Ncqrs.Tests.Domain
  12. {
  13. public class AggregateRootMappedWithAttributesTests
  14. {
  15. [Fact]
  16. public void Initializing_one_should_set_the_mapping_strategy_to_attributed_based()
  17. {
  18. var aggregateRoot = MockRepository.GenerateMock<AggregateRootMappedWithAttributes>();
  19. var field = aggregateRoot.GetType().BaseType.BaseType.GetField("_mappingStrategy", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
  20. var theStrategy = field.GetValue(aggregateRoot);
  21. theStrategy.Should().BeOfType<AttributeBasedEventHandlerMappingStrategy>();
  22. }
  23. }
  24. }