Skip to content

Instantly share code, notes, and snippets.

@davidwesst
Created September 18, 2021 16:45
Show Gist options
  • Save davidwesst/c6d8b292d71fe3cdc2919e218b9dcc84 to your computer and use it in GitHub Desktop.
Save davidwesst/c6d8b292d71fe3cdc2919e218b9dcc84 to your computer and use it in GitHub Desktop.
Which spacing on a chained method call looks better?
// one line
serviceClientMock.Setup(scm => scm.CreateBlobContainer(It.IsAny<string>(), PublicAccessType.Blob, Mock.Of<IDictionary<string, string>>(), CancellationToken.None)).Returns((string s) => Azure.Response.FromValue<BlobContainerClient>(GenerateBlobContainerClient(s).Object, Mock.Of<Azure.Response>()));
// one line per method
serviceClientMock
.Setup(scm => scm.CreateBlobContainer(It.IsAny<string>(), PublicAccessType.Blob, Mock.Of<IDictionary<string, string>>(), CancellationToken.None))
.Returns((string s) => Azure.Response.FromValue<BlobContainerClient>(GenerateBlobContainerClient(s).Object, Mock.Of<Azure.Response>()));
// one line per parameter
serviceClientMock.Setup(scm => scm.CreateBlobContainer(
It.IsAny<string>()
, PublicAccessType.Blob, Mock.Of<IDictionary<string, string>>()
, CancellationToken.None))
.Returns((string s) => Azure.Response.FromValue<BlobContainerClient>(
GenerateBlobContainerClient(s).Object,
Mock.Of<Azure.Response>()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment