unit test How to do a unit test for create method - c#

I want to write a unit test below method.
Using this method I can add a user and this is works fine. user can be saved.
public async Task<UserModel> SaveAsync(UserModel model)
{
if (string.IsNullOrEmpty(model.ExternalUserId))
{
var extUser = await identityManagementService.CreateUser(model);
user = new ApplicationUser()
{
ExternalUserId = extUser.UserId,
IsActive = true,
UserName = model.Email,
};
user.Id = Guid.NewGuid();
var exists = false;
await applicationUserRepository.AddOrUpdateAsync(user, a => exists);
}
await applicationUserRepository.SaveAsync();
var IsSaved = await identityManagementService.GetUserById(user.ExternalUserId); // to check the user is saved
return model;
}
unit test
[Fact]
public async Task SaveAsync_Should_AddORUpdate_WhenExternalUserIdDoesNOtExsitsAndProfileImgIsNull() // userRole is exist
{
var userModel = UserMockData.UserCorrectModelWithExternalUsserIdEmpty();
var applicationRole = UserMockData.ApplicationRole();
_identityManagementService.Setup(x => x.CreateUser(userModel)).Returns(Task.FromResult(UserMockData.User()));
// _identityManagementService.Setup(x => x.GetUserById(userModel.ExternalUserId)).Returns(() => null);
_applicationRoleRepository.Setup(x => x.FindAsync(userModel.RoleId)).Returns(Task.FromResult(applicationRole));
_identityManagementService.Setup(x => x.AssignUserRoles(It.Is<String>(g => g != String.Empty), applicationRole.ExternalRoleId)).Returns(Task.FromResult(true));
var sut = new UserManagementService(
_applicationRoleRepository.Object,
_applicationUserRepository.Object,
_applicationRolePermissionRepository.Object,
_identityManagementService.Object,
_smtpEmailService.Object,
_logger.Object
);
// Act
var result = await sut.SaveAsync(userModel);
//Asset
result.Should().NotBeNull();
var x = _identityManagementService.Object.GetUserById(userModel.ExternalUserId).Result; // this is null
var y = _applicationRoleRepository.Object.ListAsync(false).Result?.Count(); // this is also null
x.Should().Be(1);
}
When I check the method in debugging mode
var IsSaved = await identityManagementService.GetUserById(user.ExternalUserId); // to check the user is saved this line is not null.
But when I checked unit test debug mode,
var IsSaved = await identityManagementService.GetUserById(user.ExternalUserId); // to check the user is saved is null
How can I verify/test the user is saved by this method?
Please guide me.

Because you have not mock the GetUserById method. You have to mock the GetUserById method. In mock we are not doing actual creation that's why your GetUserById is giving result as null.
Please add below code in your test method -
_identityManagementService.Setup(x => x.GetUserById(userModel.ExternalUserId)).Returns(true);

Related

xUnit and .Net core post test case issue with automapper(I guess)

I'm working on CRUD unit test cases with having configuration .Net 5, Automapper, xUnit etc.
The issue:
So right now I'm having issue specifically in post call and when I uses Dto.
I tried lots of ways to resole it and I was also able to resolve it if I don't use Dto in post call as input parameter and just use Entity it self. (But I don't want to expose entity so I want to make it working with Dto only)
Below is test which is not working and it's controller side implementation.
Failing Test case:
[Fact]
public void PostTest()
{
try
{
//Arrange
var surveyRequest = new SurveyRequest()
{
Id = 0,
Name = "Survey Request 1",
CreateDate = DateTime.Now,
CreatedBy = 1
};
var addedSurveyRequest = new SurveyRequest()
{
Id = 1,
Name = "Survey Request 1",
CreateDate = DateTime.Now,
CreatedBy = 1
};
//setup mock
Mock<IRepositoryWrapper> mockRepo = new Mock<IRepositoryWrapper>();
mockRepo.Setup(m => m.SurveyRequest.Add(addedSurveyRequest)).Returns(new Response<SurveyRequest>(true, addedSurveyRequest));
//auto mapper
var mockMapper = new MapperConfiguration(cfg =>
{
cfg.AddProfile(new AutoMapperProfile());
});
var mapper = mockMapper.CreateMapper();
SurveyRequestController controller = new SurveyRequestController(repositories: mockRepo.Object, mapper: mapper);
//Act
var model = mapper.Map<SurveyRequest, SurveyRequestDto>(source: addedSurveyRequest);
var result = controller.Post(model); // The issue with this post call here is that response remains null on repository level.
//Assert
var okResult = result as OkObjectResult;
Assert.NotNull(okResult);
//we will make sure that returned object is dto and not actual entity
var response = okResult.Value as SurveyRequestDtoWithId;
Assert.NotNull(response);
Assert.Equal(expected: response.Name, actual: model.Name);
}
catch (Exception ex)
{
//Assert
Assert.False(true, ex.Message);
}
}
Controller side post call:
[HttpPost("Insert")]
public IActionResult Post([FromBody] SurveyRequestDto model)
{
try
{
if (!ModelState.IsValid)
return BadRequest(ModelState);
//If I remove this mapping from here, test case will work. (see next working test case)
var entity = _mapper.Map<SurveyRequestDto, SurveyRequest>(source: model);
entity.CreateDate = System.DateTime.Now;
entity.CreatedBy = 1;
var response = _repositories.SurveyRequest.Add(entity: entity); //Response remains null here
_repositories.Save();
if (response.IsSuccess == true)
return new OkObjectResult(_mapper.Map<SurveyRequest, SurveyRequestDtoWithId>(source: response.Data));
else
return new ObjectResult(response.ErrorMessage) { StatusCode = 500 };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
Working Test case:
[Fact]
public void PostTest2()
{
try
{
//Arrange
var surveyRequest = new SurveyRequest()
{
Id = 0,
Name = "Survey Request 1",
CreateDate = DateTime.Now,
CreatedBy = 1
};
var addedSurveyRequest = new SurveyRequest()
{
Id = 1,
Name = "Survey Request 1",
CreateDate = DateTime.Now,
CreatedBy = 1
};
//setup mock
Mock<IRepositoryWrapper> mockRepo = new Mock<IRepositoryWrapper>();
mockRepo.Setup(m => m.SurveyRequest.Add(surveyRequest)).Returns(value: new Response<SurveyRequest>(true, addedSurveyRequest));
//auto mapper
var mockMapper = new MapperConfiguration(cfg =>
{
cfg.AddProfile(new AutoMapperProfile());
});
var mapper = mockMapper.CreateMapper();
//setup controlller
SurveyRequestController controller = new SurveyRequestController(repositories: mockRepo.Object, mapper: mapper);
//Act
//var model = mapper.Map<SurveyRequest, SurveyRequestDto>(source: surveyRequest);
var result = controller.Post2(entity: surveyRequest);
//Assert
var okResult = result as OkObjectResult;
Assert.NotNull(okResult);
///we will make sure that returned object is dto and not actual entity
var response = okResult.Value as SurveyRequestDtoWithId;
Assert.NotNull(response);
Assert.Equal(expected: response.Id, actual: addedSurveyRequest.Id);
Assert.Equal(expected: response.Name, actual: addedSurveyRequest.Name);
}
catch (Exception ex)
{
//Assert
Assert.False(true, ex.Message);
}
}
Controller side Post call for working test case:
[HttpPost("Insert")]
public IActionResult Post2([FromBody] SurveyRequest entity)
{
try
{
if (!ModelState.IsValid)
return BadRequest(ModelState);
//var entity = _mapper.Map<SurveyRequestDto, SurveyRequest>(source: model);
//entity.CreateDate = System.DateTime.Now;
//entity.CreatedBy = 1;
var response = _repositories.SurveyRequest.Add(entity: entity); //This returns proper response with saved data and ID
_repositories.Save();
if (response.IsSuccess == true)
return new OkObjectResult(_mapper.Map<SurveyRequest, SurveyRequestDtoWithId>(source: response.Data));
else
return new ObjectResult(response.ErrorMessage) { StatusCode = 500 };
}
catch (Exception ex)
{
return new ObjectResult(ex.Message) { StatusCode = 500 };
}
}
I'm not sure whether my test case setup for mapper is wrong or any other issue. I also tried lots of ways but no luck so far. So posting here if someone can look and help, will be much appreciated.
If you are using IMapper then you can do something like this:
var mapperMock = new Mock<IMapper>();
mapperMock
.Setup(mapper => mapper.Map<SurveyRequestDto, SurveyRequest>(It.IsAny< SurveyRequestDto>()))
.Returns(surveyRequest);
This solution does not utilize the AutoMapperProfile, but because you have only a single mapping that's why I think it not really a problem.
If you want to call Verify on the mapperMock then I would suggest to extract the Map selector delegate like this:
private static Expression<Func<IMapper, SurveyRequestDto>> MapServiceModelFromRequestModelIsAny =>
mapper => mapper.Map<SurveyRequestDto, SurveyRequest>(It.IsAny< SurveyRequestDto>());
Usage
//Arrange
mapperMock
.Setup(MapServiceModelFromRequestModelIsAny)
.Returns(surveyRequest);
...
//Assert
mapperMock
.Verify(MapServiceModelFromRequestModelIsAny, Times.Once);
UPDATE #1
It might also make sense to be as explicit as possible when you make assertion. If you want to you can do deep equality check to make sure that controller's parameter is not amended before the Map call:
private static Expression<Func<IMapper, SurveyRequestDto>> MapServiceModelFromRequestModel(SurveyRequestDto input) =>
mapper => mapper.Map<SurveyRequestDto, SurveyRequest>(It.Is< SurveyRequestDto>(dto => dto.deepEquals(input)));
//Assert
mapperMock
.Verify(MapServiceModelFromRequestModel(model), Times.Once);
This assumes that deepEquals is available as an extension method.
UPDATE #2
As it turned out the mock repository's Setup code also had some problem. Namely it used the surveyRequest rather than a It.IsAny<SurveyRequest>().
Because surveyRequest was specified as the expected parameter that's why the setupped code path is never called but returned with null.
After changed it to It.IsAny then the whole test started to work :D
repoMock
.Setup(repo => repo.SurveyRequest.Add(It.IsAny<SurveyRequest>()))
.Returns(new Response<SurveyRequest>(true, addedSurveyRequest))

Moq why do mocked methods return null and tests till pass?

I am trying to mock the two interfaces below.
Mock<IEmailSender> emailSender = new Mock<IEmailSender>();
Mock<IEmailTemplate> emailTemplate = new Mock<IEmailTemplate>();
Here is the setup
emailTemplate.Setup(x => x.GetForgotPasswordTemplate(It.IsAny<EmailTemplateViewModel>())).Returns(It.IsAny<string>());
emailSender.Setup(x => x.SendEmailAsync(It.IsAny<SendEmailViewModel>(), default)).ReturnsAsync(It.IsAny<SendEmailResultViewModel>());
Here is the controller action that is called.
[EnableCors(PolicyName = "AllowClientAccess")]
[HttpGet("Forgot")]
public async Task<IActionResult> ForgotPassword([FromQuery] string email)
{
var user = await _userManager.FindByEmailAsync(email);
if (user != null)
{
//MOQ file path not found
EmailTemplateViewModel model = new EmailTemplateViewModel();
model.Email = email;
model.RecipientName = user.UserName;
var message = _emailTemplate.GetForgotPasswordTemplate(model);
SendEmailViewModel sendEmailViewModel = new SendEmailViewModel();
sendEmailViewModel.RecipientName = user.UserName;
sendEmailViewModel.RecipientEmail = user.Email;
sendEmailViewModel.Subject = "ForgotPassword";
sendEmailViewModel.Body = message;
await _emailSender.SendEmailAsync(sendEmailViewModel);
return Ok(AddSuccess("Check your email", "Forgot Password"));
}
ModelState.AddModelError("Forgot Password","Unable to send email");
return BadRequest(ModelErrors());
}
This line returns null
var message = _emailTemplate.GetForgotPasswordTemplate(model);
Here is the method code
public string GetForgotPasswordTemplate(EmailTemplateViewModel model)
{
try
{
var utcNow = DateTime.Now;
if (_testEmailTemplate == null)
if (File.Exists("Helpers/Templates/ForgotPasswordEmail.template"))
_testEmailTemplate = ReadPhysicalFile("Helpers/Templates/ForgotPasswordEmail.template");
var appUrl = _configuration.GetSection("ApplicationUrl").Value +
"/reset-password?&email=" + model.Email;
var emailMessage = _testEmailTemplate
.Replace("{user}", model.RecipientName)
.Replace("{testDate}", utcNow.ToString(CultureInfo.InvariantCulture))
.Replace("{appUrl}", appUrl);
return emailMessage;
}
catch (Exception e)
{
Log.Warning(e, "Email error");
throw;
}
}
This line also returns null
await _emailSender.SendEmailAsync(sendEmailViewModel);
Here is the method code
public Task<SendEmailResultViewModel> SendEmailAsync(SendEmailViewModel model, SmtpConfig config = default)
{
model.IsHtml = true;
var from = new MailboxAddress(_config.FromName, _config.FromEmail);
var to = new MailboxAddress(model.RecipientName, model.RecipientEmail);
return SendEmailAsync(#from, new[] {to}, model.Body, model.Body, config, model.IsHtml);
}
Here is the test
[Theory]
[InlineData("stephen#kaizenappz.com")]
public async Task WhenAUserForgetsPasswordAHttpStatusCode200ShouldBeReturnedAsync(string email)
{
var confirmUser = await Controller.ForgotPassword(email);
var result = confirmUser as OkObjectResult;
var actual = (HttpStatusCode)result?.StatusCode.Value;
var expected = HttpStatusCode.OK;
Assert.AreEqual(expected, actual);
}
However the test passes and what i am wondering is why do both of these methods return null and why does the test pass even though it returns null. How do i get these to return something?
One thing I do not understand is when to use It.Any and just pass in a normal object with some test data. How am i supposed to check a user exists if i use It.Any and i need to pass a model into my controller action?
Setup phase
Whenever you need to mock an interface method try be permissive during setup.
In other words allow to receive any parameter:
const string mockedForgotPwdTemplate = "...";
emailTemplate
.Setup(template => template.GetForgotPasswordTemplate(It.IsAny<EmailTemplateViewModel>()))
.Returns(mockedForgotPwdTemplate);
If your return value depends on the parameter
then use that overload of the Returns, which accepts a function:
const string mockedTemplateWithSubject = "...";
const string mockedTemplateWithoutSubject = "...";
emailTemplate
.Setup(template => template.GetForgotPasswordTemplate(It.IsAny<EmailTemplateViewModel>()))
.Returns((EmailTemplateViewModel vm) => !string.IsNullOrEmpty(vm.Subject) ? mockedTemplateWithSubject : mockedTemplateWithoutSubject);
Verification phase
During assertion try to be as specific as possible.
If you have access to the parameter then pass that on to the Verify:
var mockedViewTemplate = new EmailTemplateViewModel { ... };
emailTemplate
.Verify(template => template.GetForgotPasswordTemplate(mockedViewTemplate), Times.Once);
Please bear in mind that moq uses reference check to determine that the expected and actual parameter are the same. If you don't have a reference to this parameter then you should use It.Is<T>:
const string expectedSubject = "ForgotPassword";
emailTemplate
.Verify(template => template.GetForgotPasswordTemplate(
It.Is<EmailTemplateViewModel>(vm => expectedSubject == vm.Subject), Times.Once);
or if you wish to assert on more than one attribute then:
private bool AssertViewModel(EmailTemplateViewModel actualVM, string expectedSubject, string expectedRecipientName)
{
Assert.Equal(expectedSubject, actualVM.Subject);
Assert.Equal(expectedRecipientName, actualVM.RecipientName);
return true;
}
//...
const string expectedSubject = "ForgotPassword", expectedRecipent = "...";
emailTemplate
.Verify(template => template.GetForgotPasswordTemplate(
It.Is<EmailTemplateViewModel>(vm => this.AssertViewModel(vm, expectedSubject, expectedRecipient)), Times.Once);

How mock methods of repository in Service for Unit test

I try to have a unit test for my service, I mocked everything needed, How I can Mock repository methods that Service is calling so that has value and code is not breaking,
This is my unit test:
public async Task Updateuser_ReturnsResponse()
{
// Arrange
var request = new UpdateUserRequest()
{
Guid = new Guid("92296ac1-f8e1-489a-a312-6ea9d31d60f8"),
FirstName = "TestFirst",
LastName = "TestLast",
PhoneWork = "9495467845",
EmailWork = "test123#yahoo.com",
};
var respose = new UpdateUserResponse()
{
Success = true
};
var getGuidRequest = new GetGuidRequest()
{
Guid = request.Guid
};
var getGuidResponse = new GetGuidResponse()
{
Guid = request.Guid
};
var mockUserRepository = new Mock<IUserRepository>();
var mockAwsProxy = new Mock<IAwsProxy>();
mockUserRepository.Setup(s => s.UpdateUserAsync(request)).ReturnsAsync(respose);
mockUserRepository.Setup(i => i.GetGuidAsync(getGuidRequest)).ReturnsAsync(getGuidResponse);
var sut = new FromService.UserService(....);
// Act
var response = await sut.UpdateUserAsync(request);
// Assert
Assert.NotNull(response);
Assert.True(response.Success);
}
My problem is when calling - var response = await sut.UpdateUserAsync(request); It goese to service and this GuidResponse is empty so it break after as shows GuidResponse Null:
public async Task<UpdateUserResponse> UpdateUserAsync(UpdateUserRequest request)
{
if (request.EmailWork.HasValue() || request.Role.HasValue())
{
var GuidResponse = await userRepository.GetGuidAsync(new GetGuidRequest
{
Guid = request.Guid
});
// it breaks here because GuidResponse is Null.
if (GuidResponse.Guid != null && request.EmailWork.HasValue())
{
.......
It fails because the setup does not match what was actually given to the mock when the test was exercised.
Use It.Is<T>() to match the passed argument parameter
//...omitted for brevity
mockUserRepository
.Setup(_ => _.GetGuidAsync(It.Is<GetGuidRequest>(x => x.Guid == request.Guid)))
.ReturnsAsync(getGuidResponse);
//...omitted for brevity
assuming the mocked repository is what was injected into the SUT
Reference Moq Quickstart: Matching Arguments

Mock IEnumerable<T> is returning null

I am using XUnit unit tests for testing my API Controllers in .NET Core 2.1. I am using MOQ for mocking my interfaced repositories. Debugging my unit test when I do the setup it still comes out null before it even hits the controller.
I have tried constructing the result using Returns or ReturnsAsync. Using a separate function to return a list or a IEnumerable<T>.
Controller
[HttpGet]
public async Task<IActionResult> GetPendingApprovals()
{
var user = _serviceRepository.GetUserName(User);
var userId = await _serviceRepository.GetUserID(user);
var result = await _requestRepository.GetPendingApprovalsByApprover(userId);
if (!result.Any()) return NoContent();
return Ok(result);
}
Test
private Mock<IServiceRepository> mockServiceRepo;
private Mock<IRequestRepository> mockRequestRepo;
private ApprovalController controller;
public ApproverControllerTests()
{
mockServiceRepo = new Mock<IServiceRepository>();
mockRequestRepo = new Mock<IRequestRepository>();
ILogger<ApprovalController> mockLoggerRepo = Mock.Of<ILogger<ApprovalController>>();
controller = new ApprovalController(mockRequestRepo.Object, mockServiceRepo.Object, mockLoggerRepo);
}
[Fact]
public async Task GetPendingApprovals_HasPending_ReturnsResultAsync()
{
// Arrange
var mockRequests = new List<Request>
{
new Request { Id = 1,
PONumber = "ABC0001",
RequestorId = 1,
SubmitDate = new DateTime(),
ApproverId = 2,
StatusId = 1,
Split = false,
VendorId1 = 1,
Remarks = "
},
new Request { Id = 2,
PONumber = "ABC0002",
RequestorId = 1,
SubmitDate = new DateTime(),
ApproverId = 2,
StatusId = 1,
Split = false,
VendorId1 = 1,
Remarks = "
}
};
mockServiceRepo.Setup (repo => repo.GetUserID ("pstaley").Returns (Task.FromResult (1);
//var pending = mockRequests.AsEnumerable();
mockRequestRepo.Setup (repo => repo.GetPendingApprovalsByApprover (1).Returns (Task.FromResult<IEnumerable<Request>> (mockRequests);
// Act
var result = await controller.GetPendingApprovals();
// Assert
var actionResult = Assert.IsType<OkObjectResult>(result);
//Assert.Equal(mockRequests, actionResult);
}
Debugging the test itself it the mockRequest is null so when it goes to the controller it meets the null check and returns no content response.
Most likely User is null as I see no setup for that and GetUserName is not setup to do anything so that will be null as well.
thus the expectation of the mocks do not match and this returns null by default.
Loosen the expectation on the GetUserID with It.IsAny<string>() to get the expected behavior.
[Fact]
public async Task GetPendingApprovals_HasPending_ReturnsResultAsync() {
// Arrange
var mockRequests = getUsers();
var userId = 1;
mockServiceRepo
.Setup(repo => repo.GetUserID(It.IsAny<string>()))
.ReturnsAsync(userId);
mockRequestRepo
.Setup(repo => repo.GetPendingApprovalsByApprover(userId))
.ReturnsAsync(mockRequests);
// Act
var result = await controller.GetPendingApprovals();
// Assert
var actionResult = Assert.IsType<OkObjectResult>(result);
//...
}
List<Request> getUsers() {
//... omitted for brevity
}

Is it possible to use a mocked object as an input for another method up for mocking?

I created a previous Test method with setup for two mocked objects on a single Data Access and it worked fine. Did another one with same scenario but this turned out fail.
Here's the test method:
[Test]
public void UpdateUserPassword_WhenInputsAreCorrect_ReturnsQuerySuccessMessage()
{
UpdatePasswordModel input = new UpdatePasswordModel()
{
UserName = "john.doe",
NewPassword = "password1", //password1
PreviousPassword = "password" //password
};
Mock<IUserDataAccess> user = new Mock<IUserDataAccess>();
Mock<IDailyTimeInDataAccess> timeIn = new Mock<IDailyTimeInDataAccess>();
Mock<IDailyTimeOutDataAccess> timeOut = new Mock<IDailyTimeOutDataAccess>();
user.Setup(x => x.UpdatePassword(10000, input.NewPassword)).Returns("User record updated.");
user.Setup(x => x.GetUser(input.UserName)).Returns(new User()
{
UserKey = 10000,
UserName = "john.doe",
UserPassword = "LTg9BIob8urwz643K5+pBA=="
});
ILoginBusinessRules app = new LoginBusinessRules(user.Object, timeIn.Object, timeOut.Object);
var output = app.UpdateUserPassword(input);
Assert.AreEqual("User record updated.", output);
}
Here's the business rule:
public string UpdateUserPassword(UpdatePasswordModel model)
{
if (model == null)
{
return "No data to process.";
}
if (string.IsNullOrEmpty(model.UserName))
{
return "Username is empty.";
}
if (string.IsNullOrEmpty(model.NewPassword))
{
return "New Password is empty.";
}
if (string.IsNullOrEmpty(model.PreviousPassword))
{
return "Previous Password is empty.";
}
var user = _userDataAccess.GetUser(model.UserName);
if (user == null)
{
return "User not found.";
}
if (user.UserPassword != EncryptPassword(model.PreviousPassword))
{
return "Previous password does not match.";
}
else
{
user.UserPassword = EncryptPassword(model.NewPassword);
user.UpdateDttm = DateTime.Now;
user.UpdateUserId = model.UserName;
var result = _userDataAccess.UpdatePassword(user.UserKey, user.UserPassword);
return result;
}
}
The test returned a failure. Further debugging told me that this line here is returning null:
var result = _userDataAccess.UpdatePassword(user.UserKey, user.UserPassword);
Any help greatly appreciated!
The Setup uses input.NewPassword which from the test is
UpdatePasswordModel input = new UpdatePasswordModel() {
//...
NewPassword = "password1",
//...
};
//...
user.Setup(x => x.UpdatePassword(10000, input.NewPassword)).Returns("User record updated.");
//...
but in the method under test the method is called with another value
//...
user.UserPassword = EncryptPassword(model.NewPassword);
//...
var result = _userDataAccess.UpdatePassword(user.UserKey, user.UserPassword);
which wont match what was expected in the setup.
When a mocked member is not invoked with what was expected it will return the default of the return type, which in this case would be null
You would need to either make sure that the correct value is used in the setup expectation
For example
user
.Setup(x => x.UpdatePassword(10000, EncryptPassword(input.NewPassword)))
.Returns("User record updated.");
or loosen the expectation of the setup using an argument matcher like It.IsAny<T>()
user
.Setup(x => x.UpdatePassword(10000, It.IsAny<string>()))
.Returns("User record updated.");
To answer the question in the post, yes you can use any object that matches the input type. Your codes doesn't really know the difference between a "mock" and a "real" object.

Categories

Resources