public void GivenAnEntityRequest_WhenSubmittedByAnAuthenticatedUser_TheEntityIsCreated() { var fakeEntity = new Entity { Name = "John Doe", PrimaryEmail = "*****@*****.**", RegistrationNumber = "1234567", Url = "https://johndoes.com" }; var entitiesDbSetMock = new Mock <DbSet <Entity> >(); contextMock.SetupGet(r => r.Entities).Returns(entitiesDbSetMock.Object); var response = entitiesController.CreateEntity(fakeEntity) as CreatedResult; entitiesDbSetMock.Verify(r => r.Add(fakeEntity), Times.Once); contextMock.Verify(r => r.SaveChanges(), Times.Once); Assert.IsInstanceOfType(response, typeof(CreatedResult)); }