// This sample, non-production-ready project that demonstrates how to detect when an Amazon Elastic Beanstalk // platform's base AMI has been updated and starts an EC2 Image Builder Pipeline to automate the creation of a golden image. // © 2021 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. // This AWS Content is provided subject to the terms of the AWS Customer Agreement available at // http://aws.amazon.com/agreement or other written agreement between Customer and either // Amazon Web Services, Inc. or Amazon Web Services EMEA SARL or both. // SPDX-License-Identifier: MIT-0 namespace BeanstalkImageBuilderPipeline.UnitTests { using System; using Microsoft.Extensions.Logging; using Moq; public static class MockExtensions { public static Mock> VerifyMessageLogged(this Mock> logger, LogLevel expectedLogLevel, string expectedMessage, Times? times = null) { times ??= Times.Once(); logger.Verify(x => x.Log(expectedLogLevel, It.IsAny(), It.Is((v, t) => v.ToString().Contains(expectedMessage)), It.IsAny(), It.IsAny>()), times.Value); return logger; } } }