Beispiel #1
0
        public void ValidateCoreEntriesSSGFalseIfNoSSGIDs()
        {
            var entry = new Domain2.Hours.Hours
            {
                ServiceID = 1
            };

            var resolver = new CoreValidations(_resolutionServiceMock.Object, null);

            bool result = resolver.ValidateSSG(entry);

            Assert.IsFalse(result);
        }
Beispiel #2
0
        public void ValidateCoreEntriesSSGTrue()
        {
            var entry = new Domain2.Hours.Hours
            {
                ServiceID  = 1,
                Date       = new DateTime(2017, 1, 1),
                SSGCaseIDs = new int[] { 1, 2 }
            };

            _resolutionServiceMock.Setup(x => x.EntryMode).Returns(Domain2.Cases.HoursEntryMode.ProviderEntry);
            var repoMock = GetRepositoryMock(false);

            var resolver = new CoreValidations(_resolutionServiceMock.Object, repoMock.Object);

            bool result = resolver.ValidateSSG(entry);

            Assert.IsTrue(result);
        }
Beispiel #3
0
        public void ValidateCoreEntiresSSGAddsWarningIssueOnFinalizedCaseManageEntry()
        {
            var entry = new Domain2.Hours.Hours
            {
                ServiceID  = 1,
                Date       = new DateTime(2017, 1, 1),
                SSGCaseIDs = new int[] { 1, 2 }
            };

            _resolutionServiceMock.Setup(x => x.EntryMode).Returns(Domain2.Cases.HoursEntryMode.ManagementEntry);
            _resolutionServiceMock.Setup(x => x.Issues).Returns(new ValidationIssueCollection());
            var repoMock = GetRepositoryMock(true);
            var resolver = new CoreValidations(_resolutionServiceMock.Object, repoMock.Object);

            bool result = resolver.ValidateSSG(entry);

            Assert.IsTrue(_resolutionServiceMock.Object.Issues.Issues.Count == 1);
            Assert.IsTrue(_resolutionServiceMock.Object.Issues.HasWarnings);
        }
Beispiel #4
0
        public void ValidateCoreEntriesSSGAddsErrorIssueOnInsufficientCaseCount()
        {
            var entry = new Domain2.Hours.Hours
            {
                ServiceID  = 1,
                Date       = new DateTime(2017, 1, 1),
                SSGCaseIDs = new int[] { 1 }
            };

            _resolutionServiceMock.Setup(x => x.EntryMode).Returns(Domain2.Cases.HoursEntryMode.ProviderEntry);
            _resolutionServiceMock.Setup(x => x.Issues).Returns(new ValidationIssueCollection());
            var repoMock = GetRepositoryMock(true);
            var resolver = new CoreValidations(_resolutionServiceMock.Object, repoMock.Object);

            bool result = resolver.ValidateSSG(entry);

            Assert.IsTrue(_resolutionServiceMock.Object.Issues.Issues.Count == 1);
            Assert.IsTrue(_resolutionServiceMock.Object.Issues.HasErrors);
        }