Beispiel #1
0
        public async Task GetFiles_WhenUnderlyingGetFilesReturnsHResult_Throws()
        {
            var specialFiles = IVsProjectSpecialFilesFactory.ImplementGetFile((int fileId, uint flags, out uint itemId, out string fileName) => {
                itemId   = 0;
                fileName = "FileName";
                return(VSConstants.E_OUTOFMEMORY);
            });

            var manager = CreateInstance(specialFiles);

            await Assert.ThrowsAsync <OutOfMemoryException>(() => {
                return(manager.GetFileAsync(SpecialFiles.AppConfig, SpecialFileFlags.CheckoutIfExists));
            });
        }
Beispiel #2
0
        public async Task GetFiles_WhenUnderlyingGetFilesReturnsNotImpl_ReturnsNull()
        {
            var specialFiles = IVsProjectSpecialFilesFactory.ImplementGetFile((int fileId, uint flags, out uint itemId, out string fileName) => {
                itemId   = 0;
                fileName = "FileName";
                return(VSConstants.E_NOTIMPL);
            });

            var manager = CreateInstance(specialFiles);

            var result = await manager.GetFileAsync(SpecialFiles.AppConfig, SpecialFileFlags.CheckoutIfExists);

            Assert.Null(result);
        }