public void SendRequest_Request_Null_Fails() { // Arrange _autoMockContainer .Register <IRequestService, RequestService>(); var mockUnitOfWork = _autoMockContainer .GetMock <IUnitOfWork>(); var requestEntity = new Domain.Entities.Request(); mockUnitOfWork .Setup(uow => uow.CreateEntity <Domain.Entities.Request>()) .Returns(requestEntity); _autoMockContainer .GetMock <IUnitOfWorkFactory>().Setup(uowf => uowf.Create()) .Returns(mockUnitOfWork.Object); _autoMockContainer .GetMock <IDateTimeService>() .Setup(dts => dts.GetCurrentDateAndTime()) .Returns(DateTime.Now); // Act Request request = null; Assert.ThrowsDelegate sendRequestAction = () => _autoMockContainer.Resolve <IRequestService>().CreateRequest(request); // Assert Assert.Throws <ArgumentNullException>(sendRequestAction); }
/// <summary> /// Provides an instance of a specific type. /// Will usually be a <see cref="Mock"/> as provided by <see cref="GetMock{T}"/> unless a custom instance has been registered in <see cref="Register"/>. /// </summary> protected T Resolve <T>() where T : class { return(_container.Resolve <T>()); }
protected override void Before_all_tests() { base.Before_all_tests(); _testComponent = AutoMockContainer.Resolve <TestComponent>(); }
protected virtual T BuildSUT(AutoMockContainer container) { return(container.Resolve <T>()); }