Exemplo n.º 1
0
        public static void ScoresResultsIncludeStringResults()
        {
            var request = new CheckResult
            {
                Checked   = Now,
                DnsResult = new DnsResult {
                    Dmarc = true, HadResults = true, DmarcPolicy = "test"
                },
                Domain     = "test.test",
                Rank       = 0,
                HttpResult = null,
                RequestId  = Id
            };

            var result = CommonFunctionality.ScoreResult(request);

            Assert.NotNull(result);
            Assert.NotNull(result.Results);
            Assert.NotEmpty(result.Results);
            Assert.True(result.Score > 0);
            var stringDisplayResults = result.Results.OfType <StringDisplayResult>().ToList();

            Assert.NotEmpty(stringDisplayResults);
            Assert.Equal(request.DnsResult.DmarcPolicy, stringDisplayResults.First().StringResult);
        }
Exemplo n.º 2
0
        public static void ScoresResultsIfDnsNull()
        {
            var request = new CheckResult
            {
                Checked    = Now,
                DnsResult  = null,
                Domain     = "test.test",
                Rank       = 0,
                HttpResult = new HttpResult {
                    Https = true, HadResults = true
                },
                RequestId = Id
            };

            var result = CommonFunctionality.ScoreResult(request);

            Assert.NotNull(result);
            Assert.NotNull(result.Results);
            Assert.NotEmpty(result.Results);
            Assert.True(result.Score > 0);
        }
Exemplo n.º 3
0
        public static void DoesntScoreWhenNullResults()
        {
            var request = new CheckResult
            {
                Checked    = Now,
                DnsResult  = null,
                Domain     = "test.test",
                Rank       = 0,
                HttpResult = null,
                RequestId  = Id
            };


            var result = CommonFunctionality.ScoreResult(request);

            Assert.NotNull(result);
            Assert.Null(result.Results);
            Assert.Equal(0.0, result?.Score);
            Assert.Null(result?.Domain);
            Assert.Null(result?.Rating);
            Assert.Equal(default(int?), result?.Rank);
        }