using System; using System.Collections.Generic; using System.Collections.Specialized; using JetBrains.Annotations; using WireMock.Admin.Mappings; using WireMock.Logging; 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 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; } //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([NotNull] 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([CanBeNull] string folder = null); /// /// Removes the authentication. /// void RemoveAuthentication(); /// /// Resets LogEntries and Mappings. /// void Reset(); /// /// Resets the Mappings. /// void ResetMappings(); /// /// Resets all Scenarios. /// void ResetScenarios(); /// /// Resets the LogEntries. /// void ResetLogEntries(); /// /// Saves the static mappings. /// /// The optional folder. If not defined, use {CurrentFolder}/__admin/mappings void SaveStaticMappings([CanBeNull] string folder = null); /// /// Sets the basic authentication. /// /// The Tenant. /// The Audience or Resource. void SetAzureADAuthentication([NotNull] string tenant, [NotNull] string audience); /// /// Sets the basic authentication. /// /// The username. /// The password. void SetBasicAuthentication([NotNull] string username, [NotNull] string password); /// /// Sets the maximum RequestLog count. /// /// The maximum RequestLog count. void SetMaxRequestLogCount([CanBeNull] int? maxRequestLogCount); /// /// Sets RequestLog expiration in hours. /// /// The RequestLog expiration in hours. void SetRequestLogExpirationDuration([CanBeNull] 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([CanBeNull] 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); } }