Ejemplo n.º 1
0
        public void ShouldProcessContent()
        {
            // starting with a simple content scan (sync)
            var r = _client.Process(_eicarFile, new Dictionary <string, string>
            {
                { "foo", "bar" }
            });

            Log.Logger.Debug("response: {r}", r);

            Assert.NotNull(r.ResourceId);
            Assert.True(r.Findings.Contains(Finding));
            Assert.AreEqual(1, r.Findings.Count);
            Assert.AreEqual("text/plain", r.ContentType);
            Assert.AreEqual("bar", r.Metadata["foo"]);
            Assert.AreEqual(1, r.Metadata.Count);
            Assert.AreEqual(_checksum, r.Checksum);
            Assert.NotNull(r.ContentLength);
            Assert.NotNull(r.CreationDate);
            Assert.NotNull(r.RawResponse);


            Assert.NotNull(r.HostId);
            Assert.NotNull(r.ResourceId);
            Assert.NotNull(r.ResourceLocation);
            Assert.NotNull(r.RequestId);

            Assert.Null(r.Message);
            Assert.Null(r.ExpirationDate);
        }
Ejemplo n.º 2
0
        public void ShouldCreateAuthToken()
        {
            var token = _client.CreateAuthToken(5);

            Assert.NotNull(token.ResourceId);
            Assert.NotNull(token.CreationDate);
            Assert.NotNull(token.ExpirationDate);

            Log.Logger.Information("using auth token to create a new client...");

            var client2 = new ScaniiClient(ScaniiTarget.V21, token.ResourceId);

            Log.Logger.Information("using token to process content");

            var result = client2.Process(_eicarFile);

            Assert.NotNull(result.ResourceId);
            Assert.True(result.Findings.Contains(Finding));
            Assert.AreEqual(1, result.Findings.Count);
            Assert.AreEqual(_checksum, result.Checksum);
            Assert.NotNull(result.ContentLength);
            Assert.NotNull(result.CreationDate);
            Assert.NotNull(result.RawResponse);
        }