模擬EPiServerプロパティを使用してコードの一部をテストしています。そして、私は例外を得るこれらのプロパティを新たにしている間です。これはクラッシュラインです:模擬EPiServerプロパティで単体テストを実行するとエラーが発生します。
var englishContent = new PropertyXhtmlString {
Name = "EnglishOperationsMessage",
LongString = "Message content in english"};
そしてここでは、生成された例外です:
SetUp : System.TypeInitializationException :
The type initializer for 'EPiServer.Util.AutoCompressString' threw an exception.
----> System.IO.FileNotFoundException : Could not find file 'D:\Projects\Antenor-Management-System\Ams.Presenter.Test\bin\Debugweb.config'.
at EPiServer.Core.PropertyLongString.SetDefaultValue()
at EPiServer.SpecializedProperties.PropertyXhtmlString..ctor()
at Ams.Presenter.Test.Login.OperationsMessageTest.GetMockCollection() in OperationsMessageTest.cs: line 58
at Ams.Presenter.Test.Login.OperationsMessageTest.TestSetUp() in OperationsMessageTest.cs: line 19
--FileNotFoundException
at EPiServer.ConfigFileSettings.ᐁ()
at EPiServer.ConfigFileSettings.get_AllAppSettings()
at EPiServer.ApplicationConfiguration..ctor(String configFileName)
at EPiServer.ApplicationConfiguration..ctor(String configFileName, String rootVirtualPath)
at EPiServer.Global.get_EPConfig()
at EPiServer.Util.AutoCompressString..cctor()
これを解決するためにどのように任意の手掛かりをいただければ幸いです!これはEPiServer 6.42B用です。
いいえ、そうではありません。まず、テスト対象のコードで使用されているファイルを見つけて、それを目的の場所にコピーします。うまくいけば、それはトリックを行うことになります...実際には、私は空のファイルから始め、ちょうどコンストラクタが望んでいるものを正確に把握することができると思います。 – JustAnotherCoder
ええ、そのファイルは私のシステムにはまったくありません...(はい、テスト対象のコードは例外をトリガーすることなく問題のクラスのオブジェクトを作成できます)。コンストラクタを掘り下げる時間。 – JustAnotherCoder