error while use a await for async function call from a xunit testing [closed]

In below code if i add any await im getting error i don’t know why
Xunit class:

    public class EventTriggerServiceTest
    {
        private readonly Mock<ILogger<EventTriggerService>> _mockLooger;
        private readonly EventTriggerService _eventTriggerService;
        private readonly ITestOutputHelper _testOutputHelper;
        public EventTriggerServiceTest(ITestOutputHelper testOutputHelper)
        {
            _mockLooger = new Mock<ILogger<EventTriggerService>>();
            _eventTriggerService = new EventTriggerService();
            _testOutputHelper = testOutputHelper;
        }

        [Fact]
        public async Task ProcessRequestTest()
        {
            //Arrange 
            var httpRequestMock = HttpRequestDataMockFactory.CreateHttpRequestDataMock();

            //Act 
            var result = await _eventTriggerService.ProcessRequest(httpRequestMock);

            _testOutputHelper.WriteLine(result+ "-----> resultaj");

            //Assert
            Assert.NotNull(result);
        }
}

In below code is my service function i have to test this function as well
calling function

    public class EventTriggerService: IEventTriggerService
    {

      private readonly ILogger _logger;
      private string ServiceBusConnectionString;
      private ContentfulClient ContentfulClient;
      private readonly IMongoCollection<CmsEntryToDbSchema> _CmsAssetsCollection;
      private readonly IMongoCollection<CmsFailedAssetModel> _cmsFailedEntriesCollection;
      private readonly ServiceBusSender serviceBusSender;
      Helper helper = new Helper();

        public async Task<IActionResult> ProcessRequest(HttpRequestData req)
        {
        try
            {
                _logger.LogInformation("C# HTTP trigger function processed a request.");
                string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
                var requestmodel = JsonConvert.SerializeObject(requestBody);
                //string requestHead = await new StreamReader(req.Headers).ReadToEndAsync();

                string contentType = null;

                if (req.Headers.TryGetValues("X-Contentful-Topic", out var contentTypeValues))
                {
                    // Concatenate all values into a single string
                    contentType = string.Join(", ", contentTypeValues);

                    // Now you can use the contentType variable containing the concatenated values
                    Console.WriteLine($"Content-Type header value: {contentType}");
                }
                // Do something with the header name and values


                _logger.LogInformation(contentType + "header");

                string reqId = JObject.Parse(requestmodel)["entryId"].ToString();


                if (contentType == "ContentManagement.Entry.unpublish")
                {
                    var filter = Builders<CmsEntryToDbSchema>.Filter.Eq("_id", reqId.ToString());

                    var existingEntry = _CmsAssetsCollection.Find(filter).FirstOrDefault();

                    if (existingEntry != null)
                    {
                        existingEntry.entry.status = "unpublish";

                        if (existingEntry.entry.contentType.Contains("metadata"))
                        {
                            existingEntry.entry.fields.Metadata.status = "unpublish";

                        }

                        _CmsAssetsCollection.FindOneAndReplace(filter, existingEntry);
                    }
                    else

                    {
                        return new NotFoundObjectResult(new { message = "Failed to add message" });

                    }


                    var callServiceBusFunction = "needToRetry";

                    while (callServiceBusFunction == "needToRetry")
                    {
                        callServiceBusFunction = await CreateServiceBusTopicMessage(existingEntry, helper.GenarateServiceBusMessage(existingEntry.entry));
                    }

                    if (callServiceBusFunction != "needToRetry" && callServiceBusFunction != "failed")
                    {

                        return new OkObjectResult(new
                        {
                            message = "Message Added Successfully"
                        }
                        );
                    }
                    else
                    {
                        return new NotFoundObjectResult(new { message = "Resource not found" });

                    }

                }

                Console.WriteLine(reqId);

                var builder = new QueryBuilder<dynamic>().Include(10).FieldEquals("sys.id", reqId);

                var entries = await ContentfulClient.GetEntries(builder);


                var serializedEntry = JsonConvert.SerializeObject(entries);

                var settings = new JsonSerializerSettings
                {
                    MetadataPropertyHandling = MetadataPropertyHandling.Ignore
                };



                var deserializedEntry = JsonConvert.DeserializeObject<CmsDeserializer>(serializedEntry, settings);


                var entriesObject = JObject.Parse(serializedEntry);
                if (deserializedEntry.Total > 0)
                {
                    var response = await MapCmsEntry(deserializedEntry);

                    //for development purpose we use both if and else please remove else when you deploy the code
                    if (response.Count == 0)
                    {
                        return new BadRequestObjectResult(new { message = "Schema validation is failed for the given entry" });
                    }
                    var responseMessage = await CreateEntryInDB(response[0]);
                    Console.WriteLine("-----------------entry in db update completed");

                    _logger.LogInformation("Service bus message adding process completed");
                    return new OkObjectResult(responseMessage);
                }
                _logger.LogInformation("Resource not found");

                return new NotFoundObjectResult(new { message = "Resource not found" });
            }catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw;
            }
        }
   }

i am getting error like
enter image description here

in this xunit testing i am trying to use await for async function , i don’t know why i am getting this error

i am expecting error free result from xunit file while do test

New contributor

Harikarthik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật