public static bool VerifyRefreshIndex(RefreshIndex b, bool isContentId = true, bool isTrackingid = true, bool isStatus = true, bool isAdvancedInfo = false)
        {
            bool isExpected = false;

            try
            {
                if (isContentId == (b.ContentSourceId != null))
                {
                    if (isTrackingid == (b.TrackingId != null))
                    {
                        if (isStatus == (b.Status.Code == 3000))
                        {
                            if (isAdvancedInfo == (b.AdvancedInfo.Count != 0))
                            {
                                isExpected = true;
                            }
                        }
                    }
                }

                return(isExpected);
            }
            catch (Exception e)
            {
                throw new Exception("Unable to verify Status object. Error:" + e.InnerException.Message);
            }
        }
        public async Task Then_Message_Handler_Called()
        {
            //Arrange
            var handler = new Mock <IReservationIndexRefreshHandler>();

            //Act
            await RefreshIndex.Run(null,
                                   Mock.Of <ILogger <ReservationIndexRefreshHandler> >(),
                                   handler.Object);

            //Assert
            handler.Verify(s => s.Handle(), Times.Once);
        }
Example #3
0
        public async Task <ActionResult> Refresh([FromBody] RefreshIndex command)
        {
            try
            {
                var results = await _mediator.Send(command);

                if (results.IsSuccess)
                {
                    return(Ok(new
                    {
                        RefresStatus = $"Registry {command.Code} Updated successfully"
                    }));
                }

                throw new Exception(results.Error);
            }
            catch (Exception e)
            {
                var msg = $"Error loading {nameof(Registry)} information";
                Log.Error(e, msg);
                return(StatusCode(500, $"{msg} {e.Message}"));
            }
        }