public void ResolveServiceAsSingletonIfMarkedWithAttribute() { var aggregate = new FakeAggregateWithSingletonServiceBehavior(); var handleMethod = HandleByStrategyAttribute.Default.GetHandleMethods(typeof(FakeAggregateWithSingletonServiceBehavior), serviceProvider.Object).Single(); handleMethod.Value(aggregate, new FakeCommand()); handleMethod.Value(aggregate, new FakeCommand()); serviceProvider.Verify(mock => mock.GetService(typeof(FakeService)), Times.Once()); }
public void ResolveServiceAsSingletonIfMarkedWithAttribute() { var aggregate = new FakeAggregateWithSingletonServiceBehavior(); var handleMethod = HandleByStrategyAttribute.Default.GetHandleMethods(typeof(FakeAggregateWithSingletonServiceBehavior), serviceProvider.Object).Single(); handleMethod.Value(aggregate, new FakeCommand()); handleMethod.Value(aggregate, new FakeCommand()); serviceProvider.Verify(mock => mock.GetService(typeof(FakeService)), Times.Once()); }