This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics.CodeAnalysis; | |
using global::Machine.Fakes; | |
using global::Machine.Specifications; | |
/// <summary> | |
/// Casts the subject as the supplied <typeparamref name="TInterface"/> but | |
/// creates it using a concrete type and fills in dependencies using the auto faking container. | |
/// </summary> | |
/// <typeparam name="TInterface">The type of the interface.</typeparam> | |
/// <typeparam name="TConcreteType">The type of the concrete type.</typeparam> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Subject(typeof (CommonRegistry))] | |
public class When_add_common_registry_to_a_container | |
{ | |
Because of = () => ObjectFactory.Configure(x=>x.Scan(scanner=> | |
{ | |
scanner.AssemblyContainingType<ISerializer>(); | |
scanner.LookForRegistries(); | |
})); | |
It should_register_a_default_i_serializer = () => ObjectFactory.GetAllInstances<ISerializer>().Count.ShouldBeGreaterThan(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Resolves instances using the structure map object factory. | |
/// </summary> | |
public class StructureMapInstanceProvider : IInstanceProvider | |
{ | |
/// <summary> | |
/// The service type | |
/// </summary> | |
private readonly Type serviceType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ServiceModel; | |
using System.ServiceModel.Channels; | |
/// <summary> | |
/// Wraps a service client so you can use "using" without worrying of getting | |
/// your business exception swallowed. Usage: | |
/// <example> | |
/// <code> | |
/// using(var serviceClient = new ServiceClientWrapper<IServiceContract>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class When_calling_foo_service : WithIntegrationSubject<ServiceClientWrapper<IFooService>> | |
{ | |
Establish context = () => With<RunningService>(); | |
Because of = () => FooActionResponse = Subject.Channel.Action(new FooActionRequest()); | |
It should_return_a_response = () => FooActionResponse.ShouldNotBeNull(); | |
static FooActionResponse FooActionResponse; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Example | |
{ | |
public IInstanceFactory InstanceFactory { get; set; } | |
public void GetInstanceWithArgument() | |
{ | |
var foo = this.InstanceFactory<Employee, string>("ArgumentValue1") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// The result of a timing operation | |
/// </summary> | |
public interface IOperationResult : IDisposable, ISplitTimer | |
{ | |
/// <summary> | |
/// Gets or sets the elapsed time this operation took to complete. | |
/// </summary> | |
TimeSpan Elapsed { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TaskSchedulerPool | |
{ | |
private readonly List<Lazy<TaskScheduler>> _taskSchedulers; | |
public TaskSchedulerPool(int maxSize) | |
{ | |
_taskSchedulers = Enumerable.Range(1, maxSize) | |
.Select( | |
_ => new Lazy<TaskScheduler>(() => new ConcurrentExclusiveSchedulerPair().ExclusiveScheduler)) | |
.ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=vault server | |
Requires=network-online.target | |
After=network-online.target consul.service | |
[Service] | |
EnvironmentFile=-/etc/default/vault | |
Restart=on-failure | |
ExecStart=/usr/local/bin/vault server $OPTIONS -config=/etc/vault.d/vault.conf | |
ExecStartPost=/bin/bash -c "echo 'Waiting for vault to start' && sleep 5s && for key in $KEYS; do echo unsealing with key $key && /usr/local/bin/vault unseal $key; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
echo "Installing dependencies..." | |
sudo apt-get update -y | |
sudo apt-get install -y unzip | |
echo "Fetching vault..." | |
VAULT=0.6.5 |
OlderNewer