Beispiel #1
0
        public InvariantsCheckResult CheckInvariants()
        {
            if (!BookingsEnabled && _reservations.Any())
            {
                return(InvariantsCheckResult.Invalid("Room has beed disabled with active reservations"));
            }

            return(InvariantsCheckResult.Ok);
        }
Beispiel #2
0
        /// <summary>
        /// Opt-in invariants check. Only valid aggregates are persisted
        /// </summary>
        /// <returns>Check result</returns>
        public InvariantsCheckResult CheckInvariants()
        {
            if (State.NumberOfItems > 0)
            {
                return(InvariantsCheckResult.Ok);
            }

            return(InvariantsCheckResult.Invalid("Shopping cart cannot be empty"));
        }
Beispiel #3
0
 public InvariantsCheckResult CheckInvariants()
 {
     return(State.Value >= 0 ?
            InvariantsCheckResult.Ok :
            InvariantsCheckResult.Invalid("Counter is negative"));
 }
Beispiel #4
0
#pragma warning restore RCS1163 // Unused parameter.

            protected override InvariantsCheckResult OnCheckInvariants()
            {
                return(ShouldBeFalse ? InvariantsCheckResult.Invalid("Test error") : InvariantsCheckResult.Ok);
            }
Beispiel #5
0
#pragma warning restore RCS1163 // Unused parameter.

        protected override InvariantsCheckResult OnCheckInvariants()
        {
            return(Accumulator == 42 ? InvariantsCheckResult.Invalid("Test error") : InvariantsCheckResult.Ok);
        }