Commit f753cd0
Changed files (18)
lib
infrastructure
spec
unit
infrastructure
container
logging
proxies
registries
lib/infrastructure/proxies/MethodCallInvocation.cs
@@ -1,47 +1,47 @@
-using System.Collections.Generic;
-using System.Reflection;
-using System.Runtime.Remoting.Messaging;
-using gorilla.utility;
+//using System.Collections.Generic;
+//using System.Reflection;
+//using System.Runtime.Remoting.Messaging;
+//using gorilla.utility;
-namespace gorilla.infrastructure.proxies
-{
- public class MethodCallInvocation<T> : Invocation
- {
- readonly IMethodCallMessage call;
- readonly T target;
- readonly Stack<Interceptor> interceptors;
+//namespace gorilla.infrastructure.proxies
+//{
+ //public class MethodCallInvocation<T> : Invocation
+ //{
+ //readonly IMethodCallMessage call;
+ //readonly T target;
+ //readonly Stack<Interceptor> interceptors;
- public MethodCallInvocation(IEnumerable<Interceptor> interceptors, IMethodCallMessage call, T target)
- {
- this.call = call;
- this.target = target;
- this.interceptors = new Stack<Interceptor>(interceptors);
- arguments = call.Properties["__Args"].downcast_to<object[]>();
- method = call.MethodBase.downcast_to<MethodInfo>();
- }
+ //public MethodCallInvocation(IEnumerable<Interceptor> interceptors, IMethodCallMessage call, T target)
+ //{
+ //this.call = call;
+ //this.target = target;
+ //this.interceptors = new Stack<Interceptor>(interceptors);
+ //arguments = call.Properties["__Args"].downcast_to<object[]>();
+ //method = call.MethodBase.downcast_to<MethodInfo>();
+ //}
- public object[] arguments { get; set; }
+ //public object[] arguments { get; set; }
- public MethodInfo method { get; set; }
+ //public MethodInfo method { get; set; }
- public object return_value { get; set; }
+ //public object return_value { get; set; }
- public void proceed()
- {
- if (interceptors.Count > 0)
- {
- interceptors.Pop().intercept(this);
- return;
- }
+ //public void proceed()
+ //{
+ //if (interceptors.Count > 0)
+ //{
+ //interceptors.Pop().intercept(this);
+ //return;
+ //}
- try
- {
- return_value = call.MethodBase.Invoke(target, arguments);
- }
- catch (TargetInvocationException e)
- {
- throw e.InnerException.preserve_stack_trace();
- }
- }
- }
-}
\ No newline at end of file
+ //try
+ //{
+ //return_value = call.MethodBase.Invoke(target, arguments);
+ //}
+ //catch (TargetInvocationException e)
+ //{
+ //throw e.InnerException.preserve_stack_trace();
+ //}
+ //}
+ //}
+//}
lib/infrastructure/proxies/ProxyFactory.cs
@@ -1,10 +1,10 @@
-namespace gorilla.infrastructure.proxies
-{
- static public class ProxyFactory
- {
- static public T create<T>(T target, params Interceptor[] interceptors)
- {
- return new RemotingProxyFactory<T>(target, interceptors).create_proxy();
- }
- }
-}
\ No newline at end of file
+//namespace gorilla.infrastructure.proxies
+//{
+ //static public class ProxyFactory
+ //{
+ //static public T create<T>(T target, params Interceptor[] interceptors)
+ //{
+ //return new RemotingProxyFactory<T>(target, interceptors).create_proxy();
+ //}
+ //}
+//}
lib/infrastructure/proxies/RemotingProxyFactory.cs
@@ -1,44 +1,44 @@
-using System.Collections.Generic;
-using System.Runtime.Remoting.Messaging;
-using System.Runtime.Remoting.Proxies;
-using gorilla.utility;
+//using System.Collections.Generic;
+//using System.Runtime.Remoting.Messaging;
+//using System.Runtime.Remoting.Proxies;
+//using gorilla.utility;
-namespace gorilla.infrastructure.proxies
-{
- public class RemotingProxyFactory<T> : RealProxy
- {
- readonly T target;
- readonly IEnumerable<Interceptor> interceptors;
+//namespace gorilla.infrastructure.proxies
+//{
+ //public class RemotingProxyFactory<T> : RealProxy
+ //{
+ //readonly T target;
+ //readonly IEnumerable<Interceptor> interceptors;
- public RemotingProxyFactory(T target, IEnumerable<Interceptor> interceptors) : base(typeof (T))
- {
- this.target = target;
- this.interceptors = interceptors;
- }
+ //public RemotingProxyFactory(T target, IEnumerable<Interceptor> interceptors) : base(typeof (T))
+ //{
+ //this.target = target;
+ //this.interceptors = interceptors;
+ //}
- public override IMessage Invoke(IMessage message)
- {
- if (message.is_an_implementation_of<IMethodCallMessage>())
- {
- var call = message.downcast_to<IMethodCallMessage>();
- var invocation = new MethodCallInvocation<T>(interceptors, call, target);
- invocation.proceed();
- return return_value(invocation.return_value, invocation.arguments, call);
- }
- return null;
- }
+ //public override IMessage Invoke(IMessage message)
+ //{
+ //if (message.is_an_implementation_of<IMethodCallMessage>())
+ //{
+ //var call = message.downcast_to<IMethodCallMessage>();
+ //var invocation = new MethodCallInvocation<T>(interceptors, call, target);
+ //invocation.proceed();
+ //return return_value(invocation.return_value, invocation.arguments, call);
+ //}
+ //return null;
+ //}
- IMessage return_value(object return_value, object[] out_parameters, IMethodCallMessage call)
- {
- return new ReturnMessage(return_value,
- out_parameters,
- out_parameters == null ? 0 : out_parameters.Length,
- call.LogicalCallContext, call);
- }
+ //IMessage return_value(object return_value, object[] out_parameters, IMethodCallMessage call)
+ //{
+ //return new ReturnMessage(return_value,
+ //out_parameters,
+ //out_parameters == null ? 0 : out_parameters.Length,
+ //call.LogicalCallContext, call);
+ //}
- public T create_proxy()
- {
- return GetTransparentProxy().downcast_to<T>();
- }
- }
-}
\ No newline at end of file
+ //public T create_proxy()
+ //{
+ //return GetTransparentProxy().downcast_to<T>();
+ //}
+ //}
+//}
lib/lib.csproj
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
spec/unit/infrastructure/container/ResolveSpecs.cs
@@ -15,8 +15,8 @@ namespace specs.unit.infrastructure.container
{
registry = Create.an<DependencyRegistry>();
presenter = Create.an<Command>();
- registry.is_told_to(x => x.get_a<Command>()).it_will_return(presenter);
- Resolve.initialize_with(registry);
+ registry.Setup(x => x.get_a<Command>()).Returns(presenter.Object);
+ Resolve.initialize_with(registry.Object);
};
Because b = () =>
@@ -25,15 +25,15 @@ namespace specs.unit.infrastructure.container
};
It should_leverage_the_underlying_container_it_was_initialized_with =
- () => registry.was_told_to(x => x.get_a<Command>());
+ () => registry.Verify(x => x.get_a<Command>());
- It should_return_the_resolved_dependency = () => result.should_be_equal_to(presenter);
+ It should_return_the_resolved_dependency = () => result.should_be_equal_to(presenter.Object);
Cleanup a = () => Resolve.initialize_with(null);
- static DependencyRegistry registry;
+ static Moq.Mock<DependencyRegistry> registry;
static Command result;
- static Command presenter;
+ static Moq.Mock<Command> presenter;
}
[Subject(typeof (Resolve))]
@@ -42,8 +42,8 @@ namespace specs.unit.infrastructure.container
Establish c = () =>
{
registry = Create.an<DependencyRegistry>();
- registry.is_told_to(x => x.get_a<Command>()).it_will_throw(new Exception());
- Resolve.initialize_with(registry);
+ registry.Setup(x => x.get_a<Command>()).Throws(new Exception());
+ Resolve.initialize_with(registry.Object);
};
Because b = () =>
@@ -55,8 +55,8 @@ namespace specs.unit.infrastructure.container
It should_throw_a_dependency_resolution_exception = () => the_call.should_have_thrown<DependencyResolutionException<Command>>();
- static DependencyRegistry registry;
+ static Moq.Mock<DependencyRegistry> registry;
static Action the_call;
}
}
-}
\ No newline at end of file
+}
spec/unit/infrastructure/logging/LogSpecs.cs
@@ -7,7 +7,7 @@ namespace specs.unit.infrastructure.logging
[Subject(typeof (Log))]
public class when_creating_a_logger_for_a_particular_type
{
- It should_return_the_logger_created_for_that_type = () => result.should_be_equal_to(logger);
+ It should_return_the_logger_created_for_that_type = () => result.should_be_equal_to(logger.Object);
Establish c =
() =>
@@ -15,10 +15,10 @@ namespace specs.unit.infrastructure.logging
var factory = Create.an<LogFactory>();
var registry = Create.an<DependencyRegistry>();
logger = Create.an<Logger>();
- registry.is_told_to(x => x.get_a<LogFactory>()).it_will_return(factory);
- factory.is_told_to(x => x.create_for(typeof (string))).it_will_return(logger);
+ registry.Setup(x => x.get_a<LogFactory>()).Returns(factory.Object);
+ factory.Setup(x => x.create_for(typeof (string))).Returns(logger.Object);
- Resolve.initialize_with(registry);
+ Resolve.initialize_with(registry.Object);
};
Because b = () =>
@@ -29,6 +29,6 @@ namespace specs.unit.infrastructure.logging
Cleanup a = () => Resolve.initialize_with(null);
static Logger result;
- static Logger logger;
+ static Moq.Mock<Logger> logger;
}
-}
\ No newline at end of file
+}
spec/unit/infrastructure/proxies/ProxyFactorySpecs.cs
@@ -1,60 +1,60 @@
-using gorilla.infrastructure.proxies;
-using Machine.Specifications;
-
-namespace specs.unit.infrastructure.proxies
-{
- public class ProxyFactorySpecs
- {
- [Subject(typeof (ProxyFactory))]
- public class when_proxying_a_class_with_interceptors_applied
- {
- Establish c = () =>
- {
- interceptors = new MyNameIsSlimShadyInterceptor();
- marshal_mathers = new Person("marshall mathers");
- };
-
- Because b =
- () =>
- {
- some_celebrity = ProxyFactory.create<IPerson>(marshal_mathers, interceptors);
- };
-
- It should_all_each_interceptor_to_intercept_the_invocation =
- () => some_celebrity.what_is_your_name().should_be_equal_to("slim shady");
-
- static Person marshal_mathers;
- static IPerson some_celebrity;
- static Interceptor interceptors;
- }
-
- public interface IPerson
- {
- string what_is_your_name();
- }
-
- public class Person : IPerson
- {
- readonly string my_name;
-
- public Person(string my_name)
- {
- this.my_name = my_name;
- }
-
- public string what_is_your_name()
- {
- return my_name;
- }
- }
-
- public class MyNameIsSlimShadyInterceptor : Interceptor
- {
- public void intercept(Invocation invocation)
- {
- invocation.proceed();
- invocation.return_value = "slim shady";
- }
- }
- }
-}
\ No newline at end of file
+//using gorilla.infrastructure.proxies;
+//using Machine.Specifications;
+
+//namespace specs.unit.infrastructure.proxies
+//{
+ //public class ProxyFactorySpecs
+ //{
+ //[Subject(typeof (ProxyFactory))]
+ //public class when_proxying_a_class_with_interceptors_applied
+ //{
+ //Establish c = () =>
+ //{
+ //interceptors = new MyNameIsSlimShadyInterceptor();
+ //marshal_mathers = new Person("marshall mathers");
+ //};
+
+ //Because b =
+ //() =>
+ //{
+ //some_celebrity = ProxyFactory.create<IPerson>(marshal_mathers, interceptors);
+ //};
+
+ //It should_all_each_interceptor_to_intercept_the_invocation =
+ //() => some_celebrity.what_is_your_name().should_be_equal_to("slim shady");
+
+ //static Person marshal_mathers;
+ //static IPerson some_celebrity;
+ //static Interceptor interceptors;
+ //}
+
+ //public interface IPerson
+ //{
+ //string what_is_your_name();
+ //}
+
+ //public class Person : IPerson
+ //{
+ //readonly string my_name;
+
+ //public Person(string my_name)
+ //{
+ //this.my_name = my_name;
+ //}
+
+ //public string what_is_your_name()
+ //{
+ //return my_name;
+ //}
+ //}
+
+ //public class MyNameIsSlimShadyInterceptor : Interceptor
+ //{
+ //public void intercept(Invocation invocation)
+ //{
+ //invocation.proceed();
+ //invocation.return_value = "slim shady";
+ //}
+ //}
+ //}
+//}
spec/unit/infrastructure/registries/DefaultRegistrySpecs.cs
@@ -10,7 +10,7 @@ namespace specs.unit.infrastructure.registries
public class when_retrieving_all_the_items_from_the_default_repository
{
It should_leverage_the_resolver_to_retrieve_all_the_implementations =
- () => registry.was_told_to(r => r.get_all<int>());
+ () => registry.Verify(r => r.get_all<int>());
It should_return_the_items_resolved_by_the_registry = () => result.should_contain(24);
@@ -18,13 +18,13 @@ namespace specs.unit.infrastructure.registries
{
var items_to_return = new List<int> {24};
registry = Create.an<DependencyRegistry>();
- registry.is_told_to(r => r.get_all<int>()).it_will_return(items_to_return);
+ registry.Setup(r => r.get_all<int>()).Returns(items_to_return);
sut = create_sut();
};
static Registry<int> create_sut()
{
- return new DefaultRegistry<int>(registry);
+ return new DefaultRegistry<int>(registry.Object);
}
Because b = () =>
@@ -32,8 +32,8 @@ namespace specs.unit.infrastructure.registries
result = sut.all();
};
- static DependencyRegistry registry;
+ static Moq.Mock<DependencyRegistry> registry;
static IEnumerable<int> result;
static Registry<int> sut;
}
-}
\ No newline at end of file
+}
spec/unit/utility/ConfigurationExtensionsSpecs.cs
@@ -1,4 +1,3 @@
-using System.Data;
using gorilla.utility;
using Machine.Specifications;
@@ -6,9 +5,13 @@ namespace specs.unit.utility
{
public class ConfigurationExtensionsSpecs
{
+ public interface IDbCommand {
+ void Execute();
+ }
+
public class when_configuring_an_item
{
- It should_return_the_item_that_was_configured_when_completed = () => result.should_be_equal_to(item);
+ It should_return_the_item_that_was_configured_when_completed = () => result.should_be_equal_to(item.Object);
Establish context = () =>
{
@@ -18,12 +21,12 @@ namespace specs.unit.utility
Because of = () =>
{
- result = item.and_configure_with(configuration);
+ result = item.Object.and_configure_with(configuration.Object);
};
- static Configuration<IDbCommand> configuration;
- static IDbCommand item;
+ static Moq.Mock<Configuration<IDbCommand>> configuration;
+ static Moq.Mock<IDbCommand> item;
static IDbCommand result;
}
}
-}
\ No newline at end of file
+}
spec/unit/utility/MappingExtensionsSpecs.cs
@@ -14,19 +14,19 @@ namespace specs.unit.utility
second_mapper = Create.an<Mapper<string, int>>();
a = 1;
- first_mapper.is_told_to(x => x.map_from(a)).it_will_return("1");
- second_mapper.is_told_to(x => x.map_from("1")).it_will_return(1);
+ first_mapper.Setup(x => x.map_from(a)).Returns("1");
+ second_mapper.Setup(x => x.map_from("1")).Returns(1);
};
Because b = () =>
{
- result = first_mapper.then(second_mapper).map_from(a);
+ result = first_mapper.Object.then(second_mapper.Object).map_from(a);
};
static int result;
- static Mapper<object, string> first_mapper;
- static Mapper<string, int> second_mapper;
+ static Moq.Mock<Mapper<object, string>> first_mapper;
+ static Moq.Mock<Mapper<string, int>> second_mapper;
static object a;
}
-}
\ No newline at end of file
+}
spec/unit/utility/NotSpecificationSpecs.cs
@@ -8,11 +8,11 @@ namespace specs.unit.utility
[Subject(typeof (NotSpecification<>))]
public class when_checking_if_a_condition_is_not_met
{
- static protected Specification<int> criteria;
+ static protected Moq.Mock<Specification<int>> criteria;
Establish c = () =>
{
- criteria = Create.the_dependency<Specification<int>>();
+ criteria = Create.An<Specification<int>>();
sut = create_sut();
};
@@ -20,14 +20,14 @@ namespace specs.unit.utility
static Specification<int> create_sut()
{
- return new NotSpecification<int>(criteria);
+ return new NotSpecification<int>(criteria.Object);
}
}
[Subject(typeof (NotSpecification<>))]
public class when_a_condition_is_not_met : when_checking_if_a_condition_is_not_met
{
- Establish c = () => criteria.is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
+ Establish c = () => criteria.Setup(x => x.is_satisfied_by(1)).Returns(false);
Because b = () =>
{
@@ -42,7 +42,7 @@ namespace specs.unit.utility
[Subject(typeof (NotSpecification<>))]
public class when_a_condition_is_met : when_checking_if_a_condition_is_not_met
{
- Establish c = () => criteria.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+ Establish c = () => criteria.Setup(x => x.is_satisfied_by(1)).Returns(true);
Because b = () =>
{
@@ -54,4 +54,4 @@ namespace specs.unit.utility
static bool result;
}
}
-}
\ No newline at end of file
+}
spec/unit/utility/OrSpecificationSpecs.cs
@@ -10,7 +10,7 @@ namespace specs.unit.utility
{
static Specification<int> create_sut()
{
- return new OrSpecification<int>(left, right);
+ return new OrSpecification<int>(left.Object, right.Object);
}
Establish c = () =>
@@ -20,8 +20,8 @@ namespace specs.unit.utility
sut = create_sut();
};
- static protected Specification<int> left;
- static protected Specification<int> right;
+ static protected Moq.Mock<Specification<int>> left;
+ static protected Moq.Mock<Specification<int>> right;
static protected Specification<int> sut;
}
@@ -30,7 +30,7 @@ namespace specs.unit.utility
{
It should_return_true = () => result.should_be_true();
- Establish c = () => left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+ Establish c = () => left.Setup(x => x.is_satisfied_by(1)).Returns(true);
Because b = () =>
{
@@ -45,7 +45,7 @@ namespace specs.unit.utility
{
It should_return_true = () => result.should_be_true();
- Establish c = () => right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+ Establish c = () => right.Setup(x => x.is_satisfied_by(1)).Returns(true);
Because b = () =>
{
@@ -68,4 +68,4 @@ namespace specs.unit.utility
static bool result;
}
}
-}
\ No newline at end of file
+}
spec/unit/utility/SpecificationExtensionsSpecs.cs
@@ -13,8 +13,8 @@ namespace specs.unit.utility
right = Create.an<Specification<int>>();
};
- static protected Specification<int> left;
- static protected Specification<int> right;
+ static protected Moq.Mock<Specification<int>> left;
+ static protected Moq.Mock<Specification<int>> right;
}
[Subject(typeof (SpecificationExtensions))]
@@ -24,13 +24,13 @@ namespace specs.unit.utility
Establish c = () =>
{
- right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
- left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+ right.Setup(x => x.is_satisfied_by(1)).Returns(true);
+ left.Setup(x => x.is_satisfied_by(1)).Returns(true);
};
Because b = () =>
{
- result = left.or(right).is_satisfied_by(1);
+ result = left.Object.or(right.Object).is_satisfied_by(1);
};
static bool result;
@@ -43,13 +43,13 @@ namespace specs.unit.utility
Establish c = () =>
{
- right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
- left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
+ right.Setup(x => x.is_satisfied_by(1)).Returns(true);
+ left.Setup(x => x.is_satisfied_by(1)).Returns(false);
};
Because b = () =>
{
- result = left.or(right).is_satisfied_by(1);
+ result = left.Object.or(right.Object).is_satisfied_by(1);
};
static bool result;
@@ -63,16 +63,16 @@ namespace specs.unit.utility
Establish c = () =>
{
- right.is_told_to(x => x.is_satisfied_by(1)).it_will_return(false);
- left.is_told_to(x => x.is_satisfied_by(1)).it_will_return(true);
+ right.Setup(x => x.is_satisfied_by(1)).Returns(false);
+ left.Setup(x => x.is_satisfied_by(1)).Returns(true);
};
Because b = () =>
{
- result = left.or(right).is_satisfied_by(1);
+ result = left.Object.or(right.Object).is_satisfied_by(1);
};
static bool result;
}
}
-}
\ No newline at end of file
+}
spec/assertions.cs
@@ -47,15 +47,15 @@ namespace specs
items_to_peek_into.Contains(item_to_look_for).should_be_false();
}
- static public void should_be_an_instance_of<T>(this object item)
- {
- item.should_be_an_instance_of(typeof (T));
- }
+ //static public void should_be_an_instance_of<T>(this object item)
+ //{
+ //item.should_be_an_instance_of(typeof (T));
+ //}
- static public void should_be_an_instance_of(this object item, Type type)
- {
- item.ShouldBe(type);
- }
+ //static public void should_be_an_instance_of(this object item, Type type)
+ //{
+ //item.ShouldBe(type);
+ //}
static public void should_have_thrown<TheException>(this Action action) where TheException : Exception
{
@@ -91,4 +91,4 @@ namespace specs
item.ShouldBeEqualIgnoringCase(other);
}
}
-}
\ No newline at end of file
+}
spec/Create.cs
@@ -2,52 +2,20 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using Rhino.Mocks;
+using Moq;
namespace specs
{
static public class Create
{
- static public Stub an<Stub>() where Stub : class
+ static public Mock<Stub> an<Stub>() where Stub : class
{
return An<Stub>();
}
- static ItemToStub An<ItemToStub>() where ItemToStub : class
+ static public Mock<ItemToStub> An<ItemToStub>() where ItemToStub : class
{
- var type = typeof (ItemToStub);
- if (type.IsClass)
- {
- var constructors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
- if (constructors.Any(x => x.GetParameters().Length == 0))
- return MockRepository.GenerateMock<ItemToStub>();
-
- return MockRepository.GenerateMock<ItemToStub>(get_parameters_for(get_greediest_constructor_from(constructors)).ToArray());
- }
- return MockRepository.GenerateMock<ItemToStub>();
- }
-
- static IEnumerable<object> get_parameters_for(ConstructorInfo constructor)
- {
- return constructor
- .GetParameters()
- .Select(x =>
- {
- if (x.ParameterType.IsValueType)
- return Activator.CreateInstance(x.ParameterType);
- if (x.ParameterType.IsSealed) return null;
- return MockRepository.GenerateStub(x.ParameterType);
- });
- }
-
- static ConstructorInfo get_greediest_constructor_from(IEnumerable<ConstructorInfo> constructors)
- {
- return constructors.OrderBy(x => x.GetParameters().Count()).Last();
- }
-
- static public T the_dependency<T>() where T : class
- {
- return An<T>();
+ return new Mock<ItemToStub>();
}
}
-}
\ No newline at end of file
+}
spec/MockingExtensions.cs
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Rhino.Mocks;
-using Rhino.Mocks.Interfaces;
-
-namespace specs
-{
- public static class MockingExtensions
- {
- public static void was_told_to<T>(this T mocked_item, Action<T> action_to_perform)
- {
- mocked_item.AssertWasCalled(action_to_perform);
- }
-
- public static void was_not_told_to<T>(this T mocked_item, Action<T> action_to_perform)
- {
- mocked_item.AssertWasNotCalled(action_to_perform);
- }
-
- public static IMethodOptions<R> is_told_to<T, R>(this T mocked_item, Function<T, R> action_to_perform) where T : class
- {
- return mocked_item.Stub(action_to_perform);
- }
-
- public static IMethodOptions<R> is_asked_for<T, R>(this T mock, Function<T, R> func) where T : class
- {
- return mock.Stub(func);
- }
-
- public static IMethodOptions<R> it_will_return<R>(this IMethodOptions<R> options, R item)
- {
- return options.Return(item);
- }
-
- public static IMethodOptions<IEnumerable<R>> it_will_return<R>(this IMethodOptions<IEnumerable<R>> options,
- params R[] items)
- {
- return options.Return(items.AsEnumerable());
- }
-
- public static IMethodOptions<IEnumerable<R>> it_will_return_nothing<R>(
- this IMethodOptions<IEnumerable<R>> options)
- {
- return options.it_will_return();
- }
-
- public static void it_will_throw<R>(this IMethodOptions<R> options, Exception item)
- {
- options.Throw(item);
- }
- }
-}
\ No newline at end of file
spec/spec.csproj
@@ -0,0 +1,15 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="Machine.Specifications" Version="1.0.0" />
+ <PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.9.0" />
+ <PackageReference Include="Machine.Specifications.Should" Version="1.0.0" />
+ <PackageReference Include="Microsoft.NET.Test.SDK" Version="16.3.0" />
+ <PackageReference Include="Moq" Version="4.13.1" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\lib\lib.csproj" />
+ </ItemGroup>
+</Project>
jive.net.sln
@@ -3,6 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spec", "spec\spec.csproj", "{8B942D24-A3E7-4D40-8AB0-584C61584E11}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lib", "lib\lib.csproj", "{B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,4 +19,30 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Debug|x64.Build.0 = Debug|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Debug|x86.Build.0 = Debug|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Release|x64.ActiveCfg = Release|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Release|x64.Build.0 = Release|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Release|x86.ActiveCfg = Release|Any CPU
+ {8B942D24-A3E7-4D40-8AB0-584C61584E11}.Release|x86.Build.0 = Release|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Debug|x64.Build.0 = Debug|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Debug|x86.Build.0 = Debug|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Release|x64.ActiveCfg = Release|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Release|x64.Build.0 = Release|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Release|x86.ActiveCfg = Release|Any CPU
+ {B44F01C8-AFAB-4BA8-81EB-6BC7031E35F0}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
EndGlobal