GetResults() public method

public GetResults ( IInstanceInfo instanceInfo ) : ModuleResults
instanceInfo IInstanceInfo
return Kentico.KInspector.Core.ModuleResults
        public void Should_HaveStatusGood_When_PasswordPolicyDataIsGood()
        {
            // arrange...
            // Mocks...
            var mockDbs = Mock.Of<IDatabaseService>();
            Mock.Get(mockDbs).Setup(_ => _.ExecuteAndGetTableFromFile(It.IsAny<string>())).Returns(this.MakeData(true,3,0));
            var mockInstanceInfo = new Mock<IInstanceInfo>(MockBehavior.Strict);
            mockInstanceInfo.Setup(_ => _.DBService).Returns(mockDbs);

            // Real Module under test...
            PasswordPolicyModule mod = new PasswordPolicyModule();

            // act...
            var result = mod.GetResults(mockInstanceInfo.Object);

            // assert...
            StringAssert.Equals(result.ResultComment, "Password settings look good.");
            Assert.AreEqual(Status.Good, result.Status);
            mockInstanceInfo.VerifyAll();
            Mock.Get(mockDbs).VerifyAll();
        }
        public void Should_HaveStatusError_When_PasswordFormatIsNotCorrect()
        {
            // arrange...
            // Mocks...
            var mockDbs = Mock.Of<IDatabaseService>();
            Mock.Get(mockDbs).Setup(_ => _.ExecuteAndGetTableFromFile(It.IsAny<string>())).Returns(this.MakeData(false, 2,0));
            var mockInstanceInfo = new Mock<IInstanceInfo>(MockBehavior.Strict);
            mockInstanceInfo.Setup(_ => _.DBService).Returns(mockDbs);

            // Real Module under test...
            PasswordPolicyModule mod = new PasswordPolicyModule();

            // act...
            var result = mod.GetResults(mockInstanceInfo.Object);

            // assert...
            StringAssert.Equals(result.ResultComment, "The CMSPasswordFormat should be set to 'SHA2SALT'.");
            Assert.AreEqual(Status.Error, result.Status);
            mockInstanceInfo.VerifyAll();
            Mock.Get(mockDbs).VerifyAll();
        }
        public void Should_HaveStatusError_When_NoRecordsAreRetrieved()
        {
            // arrange...
            // Mocks...
            var mockDbs = Mock.Of<IDatabaseService>();
            Mock.Get(mockDbs).Setup(_ => _.ExecuteAndGetTableFromFile(It.IsAny<string>())).Returns(this.MakeEmptyTable());
            var mockInstanceInfo = new Mock<IInstanceInfo>(MockBehavior.Strict);
            mockInstanceInfo.Setup(_ => _.DBService).Returns(mockDbs);

            // Real Module under test...
            PasswordPolicyModule mod = new PasswordPolicyModule();

            // act...
            var result = mod.GetResults(mockInstanceInfo.Object);

            // assert...
            StringAssert.Equals(result.ResultComment, "Failed to check settings as expected.");
            Assert.AreEqual(Status.Error, result.Status);
            mockInstanceInfo.VerifyAll();
            Mock.Get(mockDbs).VerifyAll();
        }
        public void Should_HaveStatusWarning_When_PasswordPolicyIsFalseForAnySite()
        {
            // arrange...
            // Mocks...
            var mockDbs = Mock.Of<IDatabaseService>();
            Mock.Get(mockDbs).Setup(_ => _.ExecuteAndGetTableFromFile(It.IsAny<string>())).Returns(this.MakeData(true, 2,1));
            var mockInstanceInfo = new Mock<IInstanceInfo>(MockBehavior.Strict);
            mockInstanceInfo.Setup(_ => _.DBService).Returns(mockDbs);

            // Real Module under test...
            PasswordPolicyModule mod = new PasswordPolicyModule();

            // act...
            var result = mod.GetResults(mockInstanceInfo.Object);

            // assert...
            StringAssert.Equals(result.ResultComment, "It is recommended that you have CMSUsePasswordPolicy set to 'True'.");
            Assert.AreEqual(Status.Warning, result.Status);
            mockInstanceInfo.VerifyAll();
            Mock.Get(mockDbs).VerifyAll();
        }