Moq.Mock.Of(System.Linq.Expressions.Expression)

Here are the examples of the csharp api Moq.Mock.Of(System.Linq.Expressions.Expression) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : PowerBIClientWrapperTests.cs
with MIT License
from microsoft

private PowerBIClientWrapper CreateMockOperations(string workspaceName)
        {
            var importOperationResult = System.Threading.Tasks.Task.FromResult(new HttpOperationResponse<Import>());
            var groupList = new List<Group>
            {
                new Group(new Guid(), "testWorkspace"),
                new Group(new Guid(), "NonPremiumWorkspace", isOnDedicatedCapacity: false)
            };
            var groupOperationResult = System.Threading.Tasks.Task.FromResult(new HttpOperationResponse<Groups>()
            {
                Body = new Groups()
                {
                    Value = groupList
                }
            }
            );

            var reportOperationResult = System.Threading.Tasks.Task.FromResult(new HttpOperationResponse<Reports>()
            {
                Body = new Reports()
                {
                    Value = new List<Report>()
                }
            });

            var importClientOutput = Mock.Of<IImportsOperations>(p =>
                p.PostImportFileWithHttpMessage(
                    It.IsAny<Stream>(),
                    It.IsAny<string>(),
                    It.IsAny<ImportConflictHandlerMode?>(),
                    It.IsAny<bool?>(),
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()) == importOperationResult &&
                p.PostImportFileWithHttpMessage(
                    It.IsAny<Guid>(),
                    It.IsAny<Stream>(),
                    It.IsAny<string>(),
                    It.IsAny<ImportConflictHandlerMode?>(),
                    It.IsAny<bool?>(),
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()) == importOperationResult
                    );
            var reportClientOutput = Mock.Of<IReportsOperations>(p =>
                p.GetReportsWithHttpMessagesAsync(
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()) == reportOperationResult &&
                p.GetReportsInGroupWithHttpMessagesAsync(
                    It.IsAny<Guid>(),
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()) == reportOperationResult);
            var groupsClientOutput = Mock.Of<IGroupsOperations>(p =>
                p.GetGroupsWithHttpMessagesAsync(
                    It.IsAny<string>(),
                    It.IsAny<int?>(),
                    It.IsAny<int?>(),
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()) == groupOperationResult
                    );

            return new PowerBIClientWrapper(workspaceName, String.Empty, importClientOutput, reportClientOutput, groupsClientOutput);
        }