PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Framework/src/Ncqrs.Tests/Eventing/Storage/PropertyBagConverterTests.cs

http://github.com/ncqrs/ncqrs
C# | 40 lines | 33 code | 7 blank | 0 comment | 0 complexity | dd6c9e191e838227bf0ef994429ae85a MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0
  1. using System;
  2. using Ncqrs.Eventing.Sourcing;
  3. using Ncqrs.Eventing.Storage;
  4. using Xunit;
  5. using FluentAssertions;
  6. namespace Ncqrs.Tests.Eventing.Storage
  7. {
  8. public class PropertyBagConverterTests
  9. {
  10. public class TestEvent
  11. {
  12. public string SomeString { get; set; }
  13. }
  14. [Fact]
  15. public void Restoration_of_an_event_from_a_property_bag_containing_nulls_should_not_fail()
  16. {
  17. try
  18. {
  19. var converter = new PropertyBagConverter { TypeResolver = new SimpleEventTypeResolver() };
  20. var bag = new PropertyBag(typeof(TestEvent).AssemblyQualifiedName);
  21. bag.AddPropertyValue("SomeString", null);
  22. var obj = converter.Convert(bag);
  23. obj.Should().NotBeNull();
  24. obj.Should().BeOfType<TestEvent>();
  25. ((TestEvent) obj).SomeString.Should().BeNull();
  26. }
  27. catch(Exception e)
  28. {
  29. Assert.True(false, e.ToString());
  30. }
  31. }
  32. }
  33. }