using System; using System.Collections.Generic; using System.Collections.Specialized; using WireMock.Admin.Mappings; using WireMock.Logging; using WireMock.Types; namespace WireMock.Server; /// /// The fluent mock server interface. /// public interface IWireMockServer : IDisposable { /// /// Gets a value indicating whether this server is started. /// bool IsStarted { get; } /// /// Gets a value indicating whether this server is started with the admin interface enabled. /// bool IsStartedWithAdminInterface { get; } /// /// Gets the request logs. /// IEnumerable LogEntries { get; } /// /// Gets the mappings as MappingModels. /// IEnumerable MappingModels { get; } // // Gets the mappings. // //[PublicAPI] //IEnumerable Mappings { get; } /// /// Gets the ports. /// List Ports { get; } /// /// Gets the first port. /// int Port { get; } /// /// Gets the urls. /// string[] Urls { get; } /// /// Gets the first url. /// string? Url { get; } /// /// Gets the consumer. /// string? Consumer { get; } /// /// Gets the provider. /// string? Provider { get; } //ConcurrentDictionary Scenarios { get; } /// /// Occurs when [log entries changed]. /// event NotifyCollectionChangedEventHandler LogEntriesChanged; /// /// Adds a 'catch all mapping' /// /// - matches all Paths and any Methods /// - priority is set to 1000 /// - responds with a 404 "No matching mapping found" /// void AddCatchAllMapping(); /// /// The add request processing delay. /// /// The delay. void AddGlobalProcessingDelay(TimeSpan delay); /// /// Allows the partial mapping. /// void AllowPartialMapping(bool allow = true); /// /// Deletes a LogEntry. /// /// The unique identifier. bool DeleteLogEntry(Guid guid); /// /// Deletes the mapping. /// /// The unique identifier. bool DeleteMapping(Guid guid); //IEnumerable FindLogEntries([NotNull] params IRequestMatcher[] matchers); // IRespondWithAProvider Given(IRequestMatcher requestMatcher, bool saveToFile = false); /// /// Reads a static mapping file and adds or updates a single mapping. /// /// Calling this method manually forces WireMock.Net to read and apply the specified static mapping file. /// /// The path to the static mapping file. bool ReadStaticMappingAndAddOrUpdate(string path); /// /// Reads the static mappings from a folder. /// (This method is also used when WireMockServerSettings.ReadStaticMappings is set to true. /// /// Calling this method manually forces WireMock.Net to read and apply all static mapping files in the specified folder. /// /// The optional folder. If not defined, use {CurrentFolder}/__admin/mappings void ReadStaticMappings(string? folder = null); /// /// Removes the authentication. /// void RemoveAuthentication(); /// /// Resets LogEntries, Mappings and Scenarios. /// void Reset(); /// /// Resets the Mappings. /// void ResetMappings(); /// /// Resets all Scenarios. /// void ResetScenarios(); /// /// Resets a specific Scenario by the name. /// bool ResetScenario(string name); /// /// Resets the LogEntries. /// void ResetLogEntries(); /// /// Saves the static mappings. /// /// The optional folder. If not defined, use {CurrentFolder}/__admin/mappings void SaveStaticMappings(string? folder = null); /// /// Sets the basic authentication. /// /// The Tenant. /// The Audience or Resource. void SetAzureADAuthentication(string tenant, string audience); /// /// Sets the basic authentication. /// /// The username. /// The password. void SetBasicAuthentication(string username, string password); /// /// Sets the maximum RequestLog count. /// /// The maximum RequestLog count. void SetMaxRequestLogCount(int? maxRequestLogCount); /// /// Sets RequestLog expiration in hours. /// /// The RequestLog expiration in hours. void SetRequestLogExpirationDuration(int? requestLogExpirationDuration); /// /// Stop this server. /// void Stop(); /// /// Watches the static mappings for changes. /// /// The optional folder. If not defined, use {CurrentFolder}/__admin/mappings void WatchStaticMappings(string? folder = null); /// /// Register the mappings (via ). /// /// This can be used if you have 1 or more defined and want to register these in WireMock.Net directly instead of using the fluent syntax. /// /// The MappingModels IWireMockServer WithMapping(params MappingModel[] mappings); /// /// Register the mappings (via json string). /// /// This can be used if you the mappings as json string defined and want to register these in WireMock.Net directly instead of using the fluent syntax. /// /// The mapping(s) as json string. IWireMockServer WithMapping(string mappings); /// /// Get the C# code for a mapping. /// /// The Mapping Guid. /// The /// C# code (null in case the mapping is not found) string? MappingToCSharpCode(Guid guid, MappingConverterType converterType); /// /// Get the C# code for all mappings. /// /// The /// C# code public string MappingsToCSharpCode(MappingConverterType converterType); }