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);
        }
Beispiel #5
0
        public void ValidateCoreEntriesServiceRequired()
        {
            var entry = new Domain2.Hours.Hours();

            entry.Date      = DateTime.Now.AddDays(-1);
            entry.StartTime = new TimeSpan(1, 2, 3);
            entry.EndTime   = new TimeSpan(2, 3, 4);
            entry.Provider  = new Domain2.Providers.Provider()
            {
                ProviderTypeID = 17
            };
            entry.Memo    = "asdf";
            entry.Service = null;

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

            bool result = resolver.ValidateCoreRequirements(entry);

            Assert.IsFalse(result);
        }
Beispiel #6
0
        public void ValidateCoreEntriesIgnoresExtendedNotesOnBasicType()
        {
            var entry = new Domain2.Hours.Hours();

            entry.Date      = DateTime.Now.AddDays(-1);
            entry.StartTime = new TimeSpan(1, 2, 3);
            entry.EndTime   = new TimeSpan(2, 3, 4);
            entry.Provider  = new Domain2.Providers.Provider()
            {
                ProviderTypeID = 15
            };
            entry.ExtendedNotes = new List <Domain2.Hours.ExtendedNote>();
            entry.Service       = new Domain2.Services.Service();

            _resolutionServiceMock.Setup(x => x.EntryType).Returns(EntryType.Basic);
            var resolver = new CoreValidations(_resolutionServiceMock.Object, _resolutionServiceRepositoryMock.Object);

            bool result = resolver.ValidateCoreRequirements(entry);

            Assert.IsTrue(result);
        }