Exemple #1
0
        public void OnetimeSetup()
        {
            CommonSetup();

            _expectedInputUrl  = new Uri("https://www.myfileserver.com/myfile.png");
            _expectedOutputUrl = new Uri("https://www.s3bucket.com/buckets/rebuilt/myfile.png");

            GlasswallVersionServiceMock.Setup(s => s.GetVersion())
            .Returns(Version);

            FileTypeDetectorMock.Setup(s => s.DetermineFileType(It.IsAny <byte[]>()))
            .Returns(_expectedType = new FileTypeDetectionResponse(FileType.Bmp));

            HttpTest.ResponseQueue.Enqueue(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new ByteArrayContent(ExpectedDownloadFile)
            });

            HttpTest.ResponseQueue.Enqueue(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK
            });

            FileAnalyserMock.Setup(s => s.GetReport(
                                       It.IsAny <ContentManagementFlags>(),
                                       It.IsAny <string>(),
                                       It.IsAny <byte[]>()))
            .Returns("");

            _result = ClassInTest.AnalyseFromUrl(new UrlRequest
            {
                InputGetUrl = _expectedInputUrl
            });
        }
Exemple #2
0
        public void File_Is_Rebuilt()
        {
            FileAnalyserMock.Verify(
                s => s.GetReport(
                    It.Is <ContentManagementFlags>(x => x == Policy.DefaultContentManagementFlags),
                    It.Is <string>(x => x == _expectedType.FileTypeName),
                    It.Is <byte[]>(x => x.SequenceEqual(ExpectedDownloadFile))),
                Times.Once);

            FileAnalyserMock.VerifyNoOtherCalls();
        }
Exemple #3
0
        public void No_Engine_Actions_Are_Performed(string base64)
        {
            ClassInTest.AnalyseFromBase64(new Base64Request
            {
                Base64 = base64
            });

            GlasswallVersionServiceMock.VerifyNoOtherCalls();
            FileTypeDetectorMock.VerifyNoOtherCalls();
            FileAnalyserMock.VerifyNoOtherCalls();
        }
        public void OnetimeSetup()
        {
            CommonSetup();

            GlasswallVersionServiceMock.Setup(s => s.GetVersion())
            .Returns(Version);

            FileTypeDetectorMock.Setup(s => s.DetermineFileType(It.IsAny <byte[]>()))
            .Returns(_expectedType = new FileTypeDetectionResponse(FileType.Bmp));

            FileAnalyserMock.Setup(s => s.GetReport(
                                       It.IsAny <ContentManagementFlags>(),
                                       It.IsAny <string>(),
                                       It.IsAny <byte[]>()))
            .Returns(DummyXml);

            _result = ClassInTest.AnalyseFromBase64(new Base64Request
            {
                Base64 = "dGVzdA=="
            });
        }
Exemple #5
0
 public void No_Engine_Actions_Are_Performed()
 {
     GlasswallVersionServiceMock.VerifyNoOtherCalls();
     FileTypeDetectorMock.VerifyNoOtherCalls();
     FileAnalyserMock.VerifyNoOtherCalls();
 }
 public void File_Is_Not_Rebuilt()
 {
     FileAnalyserMock.VerifyNoOtherCalls();
 }