public void DisposeDisposesTheReferencedScope() { var scopeMock = new Mock <IDisposable>(); var testee = new NamedScopeReference(scopeMock.Object); testee.Dispose(); scopeMock.Verify(scope => scope.Dispose()); }
public void DisposeDisposesTheReferencedScope() { var scopeMock = new Mock<IDisposable>(); var testee = new NamedScopeReference(scopeMock.Object); testee.Dispose(); scopeMock.Verify(scope => scope.Dispose()); }
public void GarbageCollectDoesNotDisposeTheReferencedScope() { var scopeMock = new Mock<IDisposable>(); var testee = new NamedScopeReference(scopeMock.Object); testee.IsDisposed.Should().BeFalse(); GC.Collect(); scopeMock.Verify(scope => scope.Dispose(), Times.Never()); }
public void GarbageCollectDoesNotDisposeTheReferencedScope() { var scopeMock = new Mock <IDisposable>(); var testee = new NamedScopeReference(scopeMock.Object); testee.IsDisposed.Should().BeFalse(); GC.Collect(); scopeMock.Verify(scope => scope.Dispose(), Times.Never()); }
/// <summary> /// Setups kernel.Get{NamedScopeReference}; /// </summary> /// <param name="kernelMock">The kernel mock.</param> /// <param name="requestParameters">The request parameters.</param> private static void SetupKernelGetNamedScopeReference(Mock <IKernel> kernelMock, List <IParameter> requestParameters) { var request = new Mock <IRequest>(); var namedScopeReference = new NamedScopeReference(new DisposeNotifyingObject()); kernelMock .Setup(kernel => kernel.CreateRequest( typeof(NamedScopeReference), null, It.Is <IEnumerable <IParameter> >(p => MatchAlwaysButAddReceivedParametersToTheSpecifiedList(requestParameters, p)), false, true)) .Returns(request.Object); kernelMock .Setup(kernel => kernel.Resolve(request.Object)) .Returns(new List <object> { namedScopeReference }); }
/// <summary> /// Setups kernel.Get{NamedScopeReference}; /// </summary> /// <param name="kernelMock">The kernel mock.</param> /// <param name="requestParameters">The request parameters.</param> private static void SetupKernelGetNamedScopeReference(Mock<IKernel> kernelMock, List<IParameter> requestParameters) { var request = new Mock<IRequest>(); var namedScopeReference = new NamedScopeReference(new DisposeNotifyingObject()); kernelMock .Setup(kernel => kernel.CreateRequest( typeof(NamedScopeReference), null, It.Is<IEnumerable<IParameter>>(p => MatchAlwaysButAddReceivedParametersToTheSpecifiedList(requestParameters, p)), false, true)) .Returns(request.Object); kernelMock .Setup(kernel => kernel.Resolve(request.Object)) .Returns(new List<object> { namedScopeReference }); }