當前位置: 首頁>>代碼示例>>C#>>正文


C# MockDataStore.FileExists方法代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Commands.Common.Test.Mocks.MockDataStore.FileExists方法的典型用法代碼示例。如果您正苦於以下問題:C# MockDataStore.FileExists方法的具體用法?C# MockDataStore.FileExists怎麽用?C# MockDataStore.FileExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.WindowsAzure.Commands.Common.Test.Mocks.MockDataStore的用法示例。


在下文中一共展示了MockDataStore.FileExists方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProfileMigratesOldData

        public void ProfileMigratesOldData()
        {
            MockDataStore dataStore = new MockDataStore();
            dataStore.VirtualStore[oldProfileDataPath] = oldProfileData;
            ProfileClient.DataStore = dataStore;
            ProfileClient client = new ProfileClient();

            Assert.False(dataStore.FileExists(oldProfileDataPath));
            Assert.True(dataStore.FileExists(newProfileDataPath));
        }
開發者ID:djrosanova,項目名稱:azure-sdk-tools,代碼行數:10,代碼來源:ProfileClientTests.cs

示例2: ProfileMigratesCorruptedFileAndCreatedBackup

        public void ProfileMigratesCorruptedFileAndCreatedBackup()
        {
            MockDataStore dataStore = new MockDataStore();
            dataStore.VirtualStore[oldProfileDataPath] = oldProfileDataCorruptedFile;
            ProfileClient.DataStore = dataStore;
            ProfileClient client = new ProfileClient();

            // Verify Environment migration
            Assert.Equal(2, client.Profile.Environments.Count);
            
            // Verify subscriptions
            Assert.Equal(0, client.Profile.Subscriptions.Count);
            
            // Verify accounts
            Assert.Equal(0, client.Profile.Accounts.Count);

            // Verify backup file
            Assert.True(dataStore.FileExists(oldProfileDataPathError));
            Assert.False(dataStore.FileExists(oldProfileDataPath));
            Assert.Equal(oldProfileDataCorruptedFile, dataStore.ReadFileAsText(oldProfileDataPathError));
        }
開發者ID:khoatle,項目名稱:azure-powershell,代碼行數:21,代碼來源:ProfileClientTests.cs

示例3: ProfileMigratesAccountsSkipsBadOnesAndBacksUpFile

        public void ProfileMigratesAccountsSkipsBadOnesAndBacksUpFile()
        {
            MockDataStore dataStore = new MockDataStore();
            dataStore.VirtualStore[oldProfileDataPath] = oldProfileDataBadSubscription;
            ProfileClient.DataStore = dataStore;
            ProfileClient client = new ProfileClient();

            // Verify Environment migration
            Assert.Equal(2, client.Profile.Environments.Count);
            
            // Verify subscriptions
            Assert.Equal(3, client.Profile.Subscriptions.Count);
            Assert.True(client.Profile.Subscriptions.ContainsKey(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")));
            Assert.Equal("Test Bad Management Endpoint", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Name);
            Assert.Equal(EnvironmentName.AzureCloud, client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F")].Environment);
            Assert.Equal("Test Null Management Endpoint", client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2ADFF")].Name);
            Assert.Equal(EnvironmentName.AzureCloud, client.Profile.Subscriptions[new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2ADFF")].Environment);

            Assert.True(client.Profile.Subscriptions.ContainsKey(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")));
            Assert.Equal("Test Bad Cert", client.Profile.Subscriptions[new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f")].Name);
            
            // Verify accounts
            Assert.Equal(2, client.Profile.Accounts.Count);
            Assert.Equal("[email protected]", client.Profile.Accounts["[email protected]"].Id);
            Assert.Equal(AzureAccount.AccountType.User, client.Profile.Accounts["[email protected]"].Type);
            Assert.True(client.Profile.Accounts["[email protected]"].GetPropertyAsArray(AzureAccount.Property.Subscriptions)
                .Contains(new Guid("06E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1F").ToString()));
            Assert.True(client.Profile.Accounts["[email protected]"].GetPropertyAsArray(AzureAccount.Property.Subscriptions)
                .Contains(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f").ToString()));
            Assert.True(client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].GetPropertyAsArray(AzureAccount.Property.Subscriptions)
                .Contains(new Guid("d1e52cbc-b073-42e2-a0a0-c2f547118a6f").ToString()));
            Assert.True(client.Profile.Accounts["[email protected]"].GetPropertyAsArray(AzureAccount.Property.Tenants)
                .Contains("72f988bf-86f1-41af-91ab-2d7cd011db47"));
            Assert.False(client.Profile.Accounts["[email protected]"].GetPropertyAsArray(AzureAccount.Property.Tenants)
                .Contains("123"));
            Assert.Equal("3AF24D48B97730E5C4C9CCB12397B5E046F79E99", client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].Id);
            Assert.Equal(AzureAccount.AccountType.Certificate, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].Type);
            Assert.Equal(0, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].GetPropertyAsArray(AzureAccount.Property.Tenants).Length);
            Assert.Equal(1, client.Profile.Accounts["3AF24D48B97730E5C4C9CCB12397B5E046F79E99"].GetPropertyAsArray(AzureAccount.Property.Subscriptions).Length);

            // Verify backup file
            Assert.True(dataStore.FileExists(oldProfileDataPathError));
            Assert.False(dataStore.FileExists(oldProfileDataPath));
            Assert.Equal(oldProfileDataBadSubscription, dataStore.ReadFileAsText(oldProfileDataPathError));
        }
開發者ID:khoatle,項目名稱:azure-powershell,代碼行數:45,代碼來源:ProfileClientTests.cs


注:本文中的Microsoft.WindowsAzure.Commands.Common.Test.Mocks.MockDataStore.FileExists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。