public void WhenListUserAccountsWithUserName_ThenReturnsAccountsByUsername() { var account = new UserAccount(); storageProvider.Setup(sp => sp.Find(It.IsAny <string>())) .Returns(new[] { account }); IEnumerable <IUserAccount> result = manager.ListUserAccounts("auserid", "foo", null); storageProvider.Verify(sp => sp.Find(It.IsAny <string>()), Times.Once()); storageProvider.Verify(sp => sp.BuildQuery("Username", QueryOperator.EQ, "foo"), Times.Once()); Assert.Equal(1, result.Count()); Assert.Equal(account, result.First()); }