当前位置: 首页>>代码示例>>C#>>正文


C# StringTable.Setup方法代码示例

本文整理汇总了C#中StringTable.Setup方法的典型用法代码示例。如果您正苦于以下问题:C# StringTable.Setup方法的具体用法?C# StringTable.Setup怎么用?C# StringTable.Setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringTable的用法示例。


在下文中一共展示了StringTable.Setup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Constructor_NoStringTable_NoItemsLoaded

        public void Constructor_NoStringTable_NoItemsLoaded()
        {
            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert
            Assert.AreEqual(0, ((IDictionary<string, object>)_stringTable.Items).Count);
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:10,代码来源:StringTableTests.cs

示例2: Constructor_StringTableFound_ItemsLoadedCorrectly

        public void Constructor_StringTableFound_ItemsLoadedCorrectly()
        {
            // Assign
            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"SiteTitle\" value=\"Your site title!\" /></items>"));

            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert
            Assert.AreEqual("Your site title!", _stringTable.Items.SiteTitle);
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:13,代码来源:StringTableTests.cs

示例3: Constructor_CurrentLanguageEqualToDefaultLanguage_DefaultItemsNotLoaded

        public void Constructor_CurrentLanguageEqualToDefaultLanguage_DefaultItemsNotLoaded()
        {
            // Assign

            _languageManager.SetupGet(x => x.Language).Returns("en");
            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"SiteTitle\" value=\"Your site title!\" /></items>"));

            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert
            _fileReader.Verify(x => x.LoadXDocument(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:15,代码来源:StringTableTests.cs

示例4: GetItem_ItemNotFound_Null

        public void GetItem_ItemNotFound_Null()
        {
            // Assign

            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"FooEnum.FooItem1\" value=\"Foo\" /></items>"));
            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);

            // Act
            _stringTable.Setup();

            // Act & Assert
            Assert.IsNull(_stringTable.GetItem("Foo"));
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:13,代码来源:StringTableTests.cs

示例5: GetAssociatedValue_EnumItems_GetCorrectly

        public void GetAssociatedValue_EnumItems_GetCorrectly()
        {
            // Assign

            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"FooEnum.FooItem1\" value=\"Foo\" /></items>"));
            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);

            // Act
            _stringTable.Setup();

            // Act & Assert
            Assert.AreEqual("Foo", _stringTable.GetAssociatedValue(FooEnum.FooItem1));
            Assert.IsNull(_stringTable.GetAssociatedValue(FooEnum.FooItem2));
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:14,代码来源:StringTableTests.cs

示例6: Constructor_StringTableWithMissingItems_MissingItemsLoadedFromDefaultStringTable

        public void Constructor_StringTableWithMissingItems_MissingItemsLoadedFromDefaultStringTable()
        {
            // Assign

            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"Item1\" value=\"Foo\" /></items>"));
            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>(), It.Is<string>(d => d == DefaultLanguage))).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"Item1\" value=\"FooDef\" /><item name=\"Item2\" value=\"BarDef\" /></items>"));

            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert

            Assert.AreEqual("Foo", _stringTable.Items.Item1);
            Assert.AreEqual("BarDef", _stringTable.Items.Item2);
        }
开发者ID:jmptrader,项目名称:AcspNet,代码行数:17,代码来源:StringTableTests.cs

示例7: Constructor_CacheEnabled_LoadedFromCacheSecondTime

		public void Constructor_CacheEnabled_LoadedFromCacheSecondTime()
		{
			// Assign
			_fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>(), It.IsAny<bool>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"SiteTitle\" value=\"Your site title!\" /></items>"));

			// Act

			_stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object, true);
			_stringTable.Setup();

			_stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object, true);
			_stringTable.Setup();

			// Assert

			_fileReader.Verify(x => x.LoadXDocument(It.IsAny<string>(), It.IsAny<bool>()), Times.Once);
			Assert.AreEqual("Your site title!", _stringTable.Items.SiteTitle);
		}
开发者ID:i4004,项目名称:Simplify.Web,代码行数:18,代码来源:StringTableTests.cs


注:本文中的StringTable.Setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。