public async Task Each_Store_Data_Is_Downloaded()
 {
     await foreach (var i in _paths1)
     {
         Share1.Verify(s => s.DownloadAsync(It.Is <string>(x => x == $"{i}/metadata.json"), It.IsAny <CancellationToken>()), Times.Once);
     }
 }
        public async Task Setup()
        {
            base.SharedSetup();

            _input = new GetTransactionsRequestV1
            {
                Filter = new FileStoreFilterV1
                {
                    TimestampRangeStart = DateTimeOffset.MinValue,
                    TimestampRangeEnd   = DateTimeOffset.MaxValue
                }
            };

            Share1.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(_paths1 = GetSomePaths(1));

            Share2.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(GetNoPaths());

            var fileId = Guid.NewGuid();

            JsonSerialiser.Setup(s => s.Deserialize <TransactionAdapationEventMetadataFile>(It.IsAny <MemoryStream>(), It.IsAny <Encoding>()))
            .ReturnsAsync(_expectedMetadata = new TransactionAdapationEventMetadataFile
            {
                Events = new []
                {
                    TransactionAdaptionEventModel.NewDocumentEvent(fileId)
                }
            });

            _output = await ClassInTest.GetTransactionsAsync(_input, CancellationToken.None);
        }
Esempio n. 3
0
 public void SimplePersistenceTest()
 {
     var s1 = new Share1();
     var s2 = new Share2();
     s1.A = Guid.NewGuid().ToString();
     Assert.AreEqual(s2.B, s1.A);
 }
Esempio n. 4
0
        public void SimplePersistenceTest()
        {
            var s1 = new Share1();
            var s2 = new Share2();

            s1.A = Guid.NewGuid().ToString();
            Assert.AreEqual(s2.B, s1.A);
        }
        public async Task Setup()
        {
            base.SharedSetup();

            Share1.Setup(s => s.ExistsAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(true);

            Share1.Setup(s => s.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(null as MemoryStream);

            _output = await ClassInTest.GetDetailAsync(Input, CancellationToken.None);
        }
        public async Task Setup()
        {
            base.SharedSetup();

            Share1.Setup(s => s.ExistsAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(true);

            Share1.Setup(s => s.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(_memoryStream = new MemoryStream());

            XmlSerialiser.Setup(s => s.Deserialize <GWallInfo>(It.IsAny <Stream>(), It.IsAny <Encoding>()))
            .ReturnsAsync(_analysisReportDeserialised = new GWallInfo());

            _output = await ClassInTest.GetDetailAsync(Input, CancellationToken.None);
        }
Esempio n. 7
0
        public void Setup()
        {
            SharedSetup();

            _input = new GetTransactionsRequestV1
            {
                Filter = new FileStoreFilterV1
                {
                    TimestampRangeStart = DateTimeOffset.MinValue,
                    TimestampRangeEnd   = DateTimeOffset.MaxValue
                }
            };

            Share1.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(GetSomePaths(1));

            Share2.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(GetNoPaths());
        }
        public async Task Setup()
        {
            base.SharedSetup();

            _input = new GetTransactionsRequestV1
            {
                Filter = new FileStoreFilterV1
                {
                    TimestampRangeStart = DateTimeOffset.MinValue,
                    TimestampRangeEnd   = DateTimeOffset.MaxValue
                }
            };

            Share1.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(GetSomePaths());

            Share2.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(GetSomePaths());

            _output = await ClassInTest.GetTransactionsAsync(_input, CancellationToken.None);
        }
        public async Task Setup()
        {
            base.SharedSetup();

            _input = new GetTransactionsRequestV1
            {
                Filter = new FileStoreFilterV1
                {
                    TimestampRangeStart = DateTimeOffset.MinValue,
                    TimestampRangeEnd   = DateTimeOffset.MaxValue
                }
            };

            Share1.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(_paths1 = GetSomePaths(1));

            Share2.Setup(s => s.ListAsync(It.IsAny <IPathFilter>(), It.IsAny <CancellationToken>()))
            .Returns(_paths2 = GetSomePaths(2));

            var fileId = Guid.NewGuid();

            JsonSerialiser.Setup(s => s.Deserialize <TransactionAdapationEventMetadataFile>(It.IsAny <MemoryStream>(), It.IsAny <Encoding>()))
            .ReturnsAsync(_expectedMetadata = new TransactionAdapationEventMetadataFile
            {
                Events = new []
                {
                    TransactionAdaptionEventModel.AnalysisCompletedEvent(fileId),
                    TransactionAdaptionEventModel.FileTypeDetectedEvent(FileType.Bmp, fileId),
                    TransactionAdaptionEventModel.NcfsCompletedEvent(NcfsOutcome.Blocked, fileId),
                    TransactionAdaptionEventModel.NcfsStartedEvent(fileId),
                    TransactionAdaptionEventModel.NewDocumentEvent(fileId),
                    TransactionAdaptionEventModel.RebuildCompletedEvent(GwOutcome.Failed, fileId),
                    TransactionAdaptionEventModel.RebuildEventStarting(fileId),
                }
            });

            _output = await ClassInTest.GetTransactionsAsync(_input, CancellationToken.None);
        }
 public void Each_Store_Is_Searched()
 {
     Share1.Verify(s => s.ListAsync(It.IsAny <DatePathFilter>(), It.IsAny <CancellationToken>()), Times.Once);
     Share2.Verify(s => s.ListAsync(It.IsAny <DatePathFilter>(), It.IsAny <CancellationToken>()), Times.Once);
 }
 public void Directory_Is_Checked_For_Existence()
 {
     Share1.Verify(s => s.ExistsAsync(It.Is <string>(x => x == Input), It.IsAny <CancellationToken>()), Times.Once);
     Share2.Verify(s => s.ExistsAsync(It.Is <string>(x => x == Input), It.IsAny <CancellationToken>()), Times.Once);
 }
 public void Download_Is_Not_Attempted()
 {
     Share1.Verify(s => s.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never);
     Share2.Verify(s => s.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never);
 }
 public void Download_Is_Attempted()
 {
     Share1.Verify(s => s.DownloadAsync(It.Is <string>(x => x == $"{Input}/report.xml"), It.IsAny <CancellationToken>()), Times.Once);
     Share2.VerifyNoOtherCalls();
 }
 public void No_Data_Is_Downloaded()
 {
     Share1.Verify(f => f.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never);
     Share2.Verify(f => f.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never);
 }