public void AzureSnapshotStore_Returns_Null_When_No_Snapshot_Exists()
        {
            var database = new Mock<IAzureStorageRepository>();
            database.Setup(db => db.GetSnapshot(It.IsAny<Guid>()));

            var store = new AzureBlobSnapshotStore
            {
                GetRepository = () => database.Object
            };

            var snapshot = store.GetSnapshot<BankAccountSnapshot>(Guid.NewGuid());

            Assert.IsNull(snapshot);
        }
        public void AzureSnapshotStore_Deserializes_Snapshot_Details()
        {
            var database = new Mock<IAzureStorageRepository>();
            database.Setup(db => db.GetSnapshot(It.IsAny<Guid>())).Returns(new SnapshotDetail{SnapshotData = new BankAccountSnapshot{Balance = 900}});

            var store = new AzureBlobSnapshotStore
            {
                GetRepository = () => database.Object
            };

            var snapshot = store.GetSnapshot<BankAccountSnapshot>(Guid.NewGuid());

            Assert.AreEqual(900, snapshot.Data.Balance);
        }
Example #3
0
        public void AzureSnapshotStore_Returns_Null_When_No_Snapshot_Exists()
        {
            var database = new Mock <IAzureStorageRepository>();

            database.Setup(db => db.GetSnapshot(It.IsAny <Guid>()));

            var store = new AzureBlobSnapshotStore
            {
                GetRepository = () => database.Object
            };

            var snapshot = store.GetSnapshot <BankAccountSnapshot>(Guid.NewGuid());

            Assert.IsNull(snapshot);
        }
Example #4
0
        public void AzureSnapshotStore_Deserializes_Snapshot_Details()
        {
            var database = new Mock <IAzureStorageRepository>();

            database.Setup(db => db.GetSnapshot(It.IsAny <Guid>())).Returns(new SnapshotDetail {
                SnapshotData = new BankAccountSnapshot {
                    Balance = 900
                }
            });

            var store = new AzureBlobSnapshotStore
            {
                GetRepository = () => database.Object
            };

            var snapshot = store.GetSnapshot <BankAccountSnapshot>(Guid.NewGuid());

            Assert.AreEqual(900, snapshot.Data.Balance);
        }