public CouldNotGetOrUseAudienceEvent DeepCloneWithGetAudienceResult(GetAudienceResult getAudienceResult)
        {
            var result = new CouldNotGetOrUseAudienceEvent(
                this.Id.DeepClone(),
                this.TimestampUtc.DeepClone(),
                getAudienceResult);

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PreparedToSendOnSomeChannelsEvent"/> class.
        /// </summary>
        /// <param name="id">The notification tracking code identifier.</param>
        /// <param name="timestampUtc">The timestamp in UTC.</param>
        /// <param name="getAudienceResult">The result of executing a <see cref="GetAudienceOp"/>.</param>
        /// <param name="getDeliveryChannelConfigsResult">The result of executing a <see cref="GetDeliveryChannelConfigsOp"/>.</param>
        /// <param name="prepareToSendNotificationResult">The result of preparing to send the notification on all configured channels.</param>
        public PreparedToSendOnSomeChannelsEvent(
            long id,
            DateTime timestampUtc,
            GetAudienceResult getAudienceResult,
            GetDeliveryChannelConfigsResult getDeliveryChannelConfigsResult,
            PrepareToSendNotificationResult prepareToSendNotificationResult)
            : base(id, timestampUtc, getAudienceResult, getDeliveryChannelConfigsResult, prepareToSendNotificationResult)
        {
            var prepareToSendNotificationOutcome = prepareToSendNotificationResult.GetOutcome();

            new { prepareToSendNotificationOutcome }.AsArg().Must().BeEqualTo(PrepareToSendNotificationOutcome.PreparedToSendOnSomeChannels);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CouldNotPrepareToSendOnAnyChannelEvent"/> class.
        /// </summary>
        /// <param name="id">The notification tracking code identifier.</param>
        /// <param name="timestampUtc">The timestamp in UTC.</param>
        /// <param name="getAudienceResult">The result of executing a <see cref="GetAudienceOp"/>.</param>
        /// <param name="getDeliveryChannelConfigsResult">The result of executing a <see cref="GetDeliveryChannelConfigsOp"/>.</param>
        /// <param name="prepareToSendNotificationResult">The result of preparing to send the notification on all configured channels.</param>
        public CouldNotPrepareToSendOnAnyChannelEvent(
            long id,
            DateTime timestampUtc,
            GetAudienceResult getAudienceResult,
            GetDeliveryChannelConfigsResult getDeliveryChannelConfigsResult,
            PrepareToSendNotificationResult prepareToSendNotificationResult)
            : base(id, timestampUtc, getAudienceResult, getDeliveryChannelConfigsResult, prepareToSendNotificationResult)
        {
            var prepareToSendNotificationOutcome = prepareToSendNotificationResult.GetOutcome();

            new { prepareToSendNotificationOutcome }.AsArg().Must().BeElementIn(new[] { PrepareToSendNotificationOutcome.CouldNotPrepareToSendOnAnyChannelBecauseOneForcedAllToBeDiscarded, PrepareToSendNotificationOutcome.CouldNotPrepareToSendOnAnyChannelDespiteAttemptingAll });
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CouldNotGetOrUseAudienceEvent"/> class.
        /// </summary>
        /// <param name="id">The notification tracking code identifier.</param>
        /// <param name="timestampUtc">The timestamp in UTC.</param>
        /// <param name="getAudienceResult">The result of executing a <see cref="GetAudienceOp"/>.</param>
        public CouldNotGetOrUseAudienceEvent(
            long id,
            DateTime timestampUtc,
            GetAudienceResult getAudienceResult)
            : base(id, timestampUtc)
        {
            new { getAudienceResult }.AsArg().Must().NotBeNull();
            var getAudienceOutcome = getAudienceResult.GetOutcome();

            new { getAudienceOutcome }.AsArg().Must().BeElementIn(new[] { GetAudienceOutcome.CouldNotGetAudienceAndNoFailuresReported, GetAudienceOutcome.CouldNotGetAudienceWithSomeFailuresReported, GetAudienceOutcome.DespiteGettingAudienceFailuresPreventUsingIt });

            this.GetAudienceResult = getAudienceResult;
        }
        /// <summary>
        /// Summarize a <see cref="GetAudienceResult"/> as a <see cref="GetAudienceOutcome" />.
        /// </summary>
        /// <param name="getAudienceResult">The result of executing a <see cref="GetAudienceOp"/>.</param>
        /// <returns>
        /// A <see cref="GetAudienceResult"/> summarized as <see cref="GetAudienceOutcome"/>.
        /// </returns>
        public static GetAudienceOutcome GetOutcome(
            this GetAudienceResult getAudienceResult)
        {
            new { getAudienceResult }.AsArg().Must().NotBeNull();

            GetAudienceOutcome result;

            if (getAudienceResult.Audience == null)
            {
                if ((getAudienceResult.Failures == null) || (!getAudienceResult.Failures.Any()))
                {
                    result = GetAudienceOutcome.CouldNotGetAudienceAndNoFailuresReported;
                }
                else
                {
                    result = GetAudienceOutcome.CouldNotGetAudienceWithSomeFailuresReported;
                }
            }
            else
            {
                if ((getAudienceResult.Failures == null) || (!getAudienceResult.Failures.Any()))
                {
                    result = GetAudienceOutcome.GotAudienceWithNoFailuresReported;
                }
                else
                {
                    if (getAudienceResult.FailureAction == FailureAction.Stop)
                    {
                        result = GetAudienceOutcome.DespiteGettingAudienceFailuresPreventUsingIt;
                    }
                    else if (getAudienceResult.FailureAction == FailureAction.IgnoreAndProceedIfPossibleOtherwiseStop)
                    {
                        result = GetAudienceOutcome.GotAudienceWithReportedFailuresIgnored;
                    }
                    else
                    {
                        throw new NotSupportedException(Invariant($"This {nameof(FailureAction)} is not supported: {getAudienceResult.FailureAction}."));
                    }
                }
            }

            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CouldNotGetOrUseDeliveryChannelConfigsEvent"/> class.
        /// </summary>
        /// <param name="id">The notification tracking code identifier.</param>
        /// <param name="timestampUtc">The timestamp in UTC.</param>
        /// <param name="getAudienceResult">The result of executing a <see cref="GetAudienceOp"/>.</param>
        /// <param name="getDeliveryChannelConfigsResult">The result of executing a <see cref="GetDeliveryChannelConfigsOp"/>.</param>
        public CouldNotGetOrUseDeliveryChannelConfigsEvent(
            long id,
            DateTime timestampUtc,
            GetAudienceResult getAudienceResult,
            GetDeliveryChannelConfigsResult getDeliveryChannelConfigsResult)
            : base(id, timestampUtc)
        {
            new { getAudienceResult }.AsArg().Must().NotBeNull();
            var getAudienceOutcome = getAudienceResult.GetOutcome();

            new { getAudienceOutcome }.AsArg().Must().BeElementIn(new[] { GetAudienceOutcome.GotAudienceWithNoFailuresReported, GetAudienceOutcome.GotAudienceWithReportedFailuresIgnored });

            new { getDeliveryChannelConfigsResult }.AsArg().Must().NotBeNull();
            var getDeliveryChannelConfigsOutcome = getDeliveryChannelConfigsResult.GetOutcome();

            new { getDeliveryChannelConfigsOutcome }.AsArg().Must().BeElementIn(new[] { GetDeliveryChannelConfigsOutcome.CouldNotGetDeliveryChannelConfigsAndNoFailuresReported, GetDeliveryChannelConfigsOutcome.CouldNotGetDeliveryChannelConfigsWithSomeFailuresReported, GetDeliveryChannelConfigsOutcome.DespiteGettingDeliveryChannelConfigsFailuresPreventUsingThem });

            this.GetAudienceResult = getAudienceResult;
            this.GetDeliveryChannelConfigsResult = getDeliveryChannelConfigsResult;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PrepareToSendNotificationEventBase"/> class.
        /// </summary>
        /// <param name="id">The notification tracking code identifier.</param>
        /// <param name="timestampUtc">The timestamp in UTC.</param>
        /// <param name="getAudienceResult">The result of executing a <see cref="GetAudienceOp"/>.</param>
        /// <param name="getDeliveryChannelConfigsResult">The result of executing a <see cref="GetDeliveryChannelConfigsOp"/>.</param>
        /// <param name="prepareToSendNotificationResult">The result of preparing to send the notification on all configured channels.</param>
        protected PrepareToSendNotificationEventBase(
            long id,
            DateTime timestampUtc,
            GetAudienceResult getAudienceResult,
            GetDeliveryChannelConfigsResult getDeliveryChannelConfigsResult,
            PrepareToSendNotificationResult prepareToSendNotificationResult)
            : base(id, timestampUtc)
        {
            new { getAudienceResult }.AsArg().Must().NotBeNull();
            var getAudienceOutcome = getAudienceResult.GetOutcome();

            new { getAudienceOutcome }.AsArg().Must().BeElementIn(new[] { GetAudienceOutcome.GotAudienceWithNoFailuresReported, GetAudienceOutcome.GotAudienceWithReportedFailuresIgnored });

            new { getDeliveryChannelConfigsResult }.AsArg().Must().NotBeNull();
            var getDeliveryChannelConfigsOutcome = getDeliveryChannelConfigsResult.GetOutcome();

            new { getDeliveryChannelConfigsOutcome }.AsArg().Must().BeElementIn(new[] { GetDeliveryChannelConfigsOutcome.GotDeliveryChannelConfigsWithNoFailuresReported, GetDeliveryChannelConfigsOutcome.GotDeliveryChannelConfigsWithReportedFailuresIgnored });

            new { prepareToSendNotificationResult }.AsArg().Must().NotBeNull();

            this.GetAudienceResult = getAudienceResult;
            this.GetDeliveryChannelConfigsResult = getDeliveryChannelConfigsResult;
            this.PrepareToSendNotificationResult = prepareToSendNotificationResult;
        }
Exemplo n.º 8
0
        public override PrepareToSendNotificationEventBase DeepCloneWithGetAudienceResult(GetAudienceResult getAudienceResult)
        {
            var result = new PreparedToSendOnAllChannelsEvent(
                this.Id.DeepClone(),
                this.TimestampUtc.DeepClone(),
                getAudienceResult,
                this.GetDeliveryChannelConfigsResult?.DeepClone(),
                this.PrepareToSendNotificationResult?.DeepClone());

            return(result);
        }
 public virtual PrepareToSendNotificationEventBase DeepCloneWithGetAudienceResult(GetAudienceResult getAudienceResult)
 {
     throw new NotImplementedException("This method should be abstract.  It was generated as virtual so that you aren't forced to override it when you create a new model that derives from this model.  It will be overridden in the generated designer file.");
 }
        public CouldNotGetOrUseDeliveryChannelConfigsEvent DeepCloneWithGetAudienceResult(GetAudienceResult getAudienceResult)
        {
            var result = new CouldNotGetOrUseDeliveryChannelConfigsEvent(
                this.Id.DeepClone(),
                this.TimestampUtc.DeepClone(),
                getAudienceResult,
                this.GetDeliveryChannelConfigsResult?.DeepClone());

            return(result);
        }