public async void ShouldCreateFileCorrectly() { var ms = new MemoryStream(); var fileMock = new Mock <IFile>(); fileMock .Setup(x => x.Create(It.IsAny <string>())) .Returns(ms); var fsMock = new Mock <IFileSystem>(); fsMock .Setup(x => x.File) .Returns(fileMock.Object); var fileStore = new FileStore(fsMock.Object, BuildFakeConfiguration()); var id = await fileStore.CreateFile(Convert.FromBase64String("aGVsbG93b3JsZA==")); id.Should().NotBeEmpty(); Convert.ToBase64String(ms.ToArray()).Should().BeEquivalentTo("aGVsbG93b3JsZA=="); }