Documentation Coverage Report
Current view: top level - Azure/Tests/Cqrs.Azure.BlobStorage.Test.Integration - BlobStorageDataStoreTests.cs Hit Total Coverage
Version: 2.2 Artefacts: 2 2 100.0 %
Date: 2017-09-22

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="Chinchilla Software Limited">
       4             : // //   Copyright Chinchilla Software Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System;
      10             : using System.Collections.Generic;
      11             : using System.Diagnostics;
      12             : using cdmdotnet.Logging;
      13             : using cdmdotnet.Logging.Configuration;
      14             : using cdmdotnet.StateManagement.Threaded;
      15             : using Cqrs.Azure.BlobStorage.DataStores;
      16             : using Cqrs.Azure.ServiceBus.Tests.Unit;
      17             : using Cqrs.Configuration;
      18             : using Cqrs.DataStores;
      19             : using Cqrs.Entities;
      20             : using NUnit.Framework;
      21             : using TestClass = NUnit.Framework.TestFixtureAttribute;
      22             : using TestMethod = NUnit.Framework.TestAttribute;
      23             : using TestInitialize = NUnit.Framework.SetUpAttribute;
      24             : using TestCleanup = NUnit.Framework.TearDownAttribute;
      25             : using TestContext = System.Object;
      26             : 
      27             : namespace Cqrs.Azure.BlobStorage.Test.Integration
      28             : {
      29             :         /// <summary>
      30             :         /// A series of tests on the <see cref="BlobStorageDataStore{TData}"/> class
      31             :         /// </summary>
      32             :         [TestClass]
      33             :         public class BlobStorageDataStoreTests
      34           1 :         {
      35             :                 /// <summary>
      36             :                 /// Tests the <see cref="IDataStore{TData}.Add(TData)"/> method
      37             :                 /// Passing a valid test <see cref="IEntity"/>
      38             :                 /// Expecting the test <see cref="IEntity"/> is able to be read.
      39             :                 /// </summary>
      40             :                 [TestMethod]
      41           1 :                 public virtual void Save_ValidProjectionView_ProjectionViewCanBeRetreived()
      42             :                 {
      43             :                         // Arrange
      44             :                         var correlationIdHelper = new CorrelationIdHelper(new ThreadedContextItemCollectionFactory());
      45             :                         correlationIdHelper.SetCorrelationId(Guid.NewGuid());
      46             :                         var logger = new ConsoleLogger(new LoggerSettingsConfigurationSection(), correlationIdHelper);
      47             :                         var dataStore = new BlobStorageDataStore<TestEvent>(logger, new BlobStorageDataStoreConnectionStringFactory(new ConfigurationManager(), logger));
      48             : 
      49             :                         var event1 = new TestEvent
      50             :                         {
      51             :                                 Rsn = Guid.NewGuid(),
      52             :                                 Id = Guid.NewGuid(),
      53             :                                 CorrelationId = correlationIdHelper.GetCorrelationId(),
      54             :                                 Frameworks = new List<string> { "Test 1" },
      55             :                                 TimeStamp = DateTimeOffset.UtcNow
      56             :                         };
      57             : 
      58             :                         // Act
      59             :                         dataStore.Add(event1);
      60             : 
      61             :                         // Assert
      62             :                         var timer = new Stopwatch();
      63             :                         timer.Start();
      64             :                         TestEvent view = dataStore.GetByName(event1.Rsn);
      65             :                         timer.Stop();
      66             :                         Console.WriteLine("Load operation took {0}", timer.Elapsed);
      67             :                         Assert.IsNotNull(view);
      68             :                         Assert.AreEqual(event1.Id, view.Id);
      69             :                 }
      70             :         }
      71             : }

Generated by: LCOV version 1.10