You are testing a non-query scenario (http://msdn.microsoft.com/en-us/library/dn314429.aspx#nonQuery). Moq
has the Verify
method for this purpose:
mockSet.Verify(m => m.Add(It.IsAny<User>()), Times.Once());
mockContext.Verify(m => m.SaveChanges(), Times.Once());
As an aside, you probably don't want the Save()
method on your repository. I'd suggest investigating the Unit of Work pattern, which will allow you to coordinate changes across different repositories by ensuring they all share the same context.