LCOV - code coverage report
Current view: top level - Azure/Cqrs.Azure.ServiceBus.Tests.Unit - MessageSerialiserTests.cs Hit Total Coverage
Test: doc-coverage.info Lines: 1 5 20.0 %
Date: 2017-07-26

          Line data    Source code
       1             : using System;
       2             : using Cqrs.Commands;
       3             : using Cqrs.Events;
       4             : using NUnit.Framework;
       5             : using TestClass = NUnit.Framework.TestFixtureAttribute;
       6             : using TestMethod = NUnit.Framework.TestAttribute;
       7             : using TestInitialize = NUnit.Framework.SetUpAttribute;
       8             : using TestCleanup = NUnit.Framework.TearDownAttribute;
       9             : using TestContext = System.Object;
      10             : 
      11             : namespace Cqrs.Azure.ServiceBus.Tests.Unit
      12             : {
      13             :         /// <summary>
      14             :         /// A series of tests on the <see cref="MessageSerialiser{TAuthenticationToken}"/> class
      15             :         /// </summary>
      16             :         [TestClass]
      17             :         public class MessageSerialiserTests
      18           1 :         {
      19             :                 private const string GoodEventData = "{\"$id\":\"1\",\"$type\":\"Cqrs.Azure.ServiceBus.Tests.Unit.TestEvent, Cqrs.Azure.ServiceBus.Tests.Unit\",\"Id\":\"a3008122-b365-45ef-86ec-865df098b886\"}";
      20             : 
      21             :                 private const string GoodCommandData = "{\"$id\":\"1\",\"$type\":\"Cqrs.Azure.ServiceBus.Tests.Unit.TestCommand, Cqrs.Azure.ServiceBus.Tests.Unit\",\"Id\":\"17c0585b-3b24-4865-9afc-5fa97e36606a\"}";
      22             : 
      23             :                 [TestMethod]
      24           0 :                 public void SerialisEvent_TestEvent_ExpectedSerialisedData()
      25             :                 {
      26             :                         // Arrange
      27             :                         var eventSerialiser = new MessageSerialiser<Guid>();
      28             : 
      29             :                         // Act
      30             :                         string data = eventSerialiser.SerialiseEvent(new TestEvent { Id = new Guid("a3008122-b365-45ef-86ec-865df098b886") });
      31             : 
      32             :                         // Assert
      33             :                         Assert.AreEqual(GoodEventData, data);
      34             :                 }
      35             : 
      36             :                 [TestMethod]
      37           0 :                 public void DeserialisEvent_TestEventData_ExpectedEvent()
      38             :                 {
      39             :                         // Arrange
      40             :                         var eventSerialiser = new MessageSerialiser<Guid>();
      41             : 
      42             :                         // Act
      43             :                         IEvent<Guid> @event = eventSerialiser.DeserialiseEvent(GoodEventData);
      44             : 
      45             :                         // Assert
      46             :                         Assert.AreEqual("Cqrs.Azure.ServiceBus.Tests.Unit.TestEvent", @event.GetType().FullName);
      47             :                 }
      48             : 
      49             :                 [TestMethod]
      50           0 :                 public void SerialisCommand_TestCommand_ExpectedSerialisedData()
      51             :                 {
      52             :                         // Arrange
      53             :                         var command = new MessageSerialiser<Guid>();
      54             : 
      55             :                         // Act
      56             :                         string data = command.SerialiseCommand(new TestCommand { Id = new Guid("17c0585b-3b24-4865-9afc-5fa97e36606a") });
      57             : 
      58             :                         // Assert
      59             :                         Assert.AreEqual(GoodCommandData, data);
      60             :                 }
      61             : 
      62             :                 [TestMethod]
      63           0 :                 public void DeserialisCommand_TestCommandData_ExpectedCommand()
      64             :                 {
      65             :                         // Arrange
      66             :                         var commandSerialiser = new MessageSerialiser<Guid>();
      67             : 
      68             :                         // Act
      69             :                         ICommand<Guid> command = commandSerialiser.DeserialiseCommand(GoodCommandData);
      70             : 
      71             :                         // Assert
      72             :                         Assert.AreEqual("Cqrs.Azure.ServiceBus.Tests.Unit.TestCommand", command.GetType().FullName);
      73             :                 }
      74             :         }
      75             : }

Generated by: LCOV version 1.10