Esempio n. 1
0
        private bool Contribute_Event_Works()
        {
            using (var ioc = DependencyContainer.Resolve <IRecentInfoCommandService>())
            {
                var data = new RecentEventDetails()
                {
                    CaseNumber   = "010514-00001",
                    DateReported = DateTime.Now,
                    Description  = new TriTech.InformRMS.Infrastructure.CodeValues.CodeValue("WHY", "Description of an Event"),
                    EndDate      = DateTime.Now.AddYears(2),
                    //Location = HostTestService.NewLocation,
                    Number    = "000000001",
                    StartDate = DateTime.Now.AddYears(-2)
                };

                var svc = ioc.Instance;
                var contributionDetails = new ContributionDetails()
                {
                    Contributor  = "TEST",
                    Agency       = "TEST",
                    ResourceId   = Guid.NewGuid().ToString(),
                    ResourceType = "Event",
                    System       = "InformRMSTest"
                };
                var id = svc.ContributeEvent(contributionDetails, RecentInfoType.MISC, data);
                return(id != Guid.Empty);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Return True if the Event data is useful.
        /// </summary>
        private static bool UsefulEventData(RecentEventDetails details)
        {
            if (details == null)
            {
                return(false);
            }

            var hasCaseNumber = !string.IsNullOrEmpty(details.CaseNumber);
            var hasNumber     = !string.IsNullOrEmpty(details.Number);
            var hasAddress    = details.Address != null && !string.IsNullOrEmpty(details.Address.StreetAddress);

            return(hasCaseNumber || hasNumber || hasAddress);
        }
        public void RecentInfoCommandService_CheckNotUsefulEventData()
        {
            var recentInfoCommandService = GetDependency <IRecentInfoCommandService>();

            Assert.IsInstanceOfType(recentInfoCommandService, typeof(IRecentInfoCommandService));
            RecentEventDetails recentEventDetails = MockObjects.NewRecentEventDetails;

            recentEventDetails.CaseNumber = null;
            recentEventDetails.Number     = null;
            recentEventDetails.Address    = null;
            Guid contributeEventId = recentInfoCommandService.ContributeEvent(MockObjects.NewContributionDetails, RecentInfoType.FI, recentEventDetails);

            Assert.AreEqual(contributeEventId, Guid.Empty);
            Assert.IsInstanceOfType(contributeEventId, typeof(Guid));
        }
Esempio n. 4
0
        public Guid ContributeEvent(ContributionDetails contributionDetails, RecentInfoType recentInfoType, RecentEventDetails details)
        {
            purgeOldRecords("RecentEvents");

            return(UsefulEventData(details)
                ? ProcessContribution(contributionDetails, details,
                                      () => new RecentEvent(contributionDetails.As <Domain.RecentInfo.ValueObjects.ContributionDetails>(), recentInfoType))
                : Guid.Empty);
        }