microsoft-fakes

    13熱度

    3回答

    我在一個使用微軟假貨的解決方案中有一個單元測試項目,當我構建它時會得到下面的錯誤。它抱怨無法加載的DLL在磁盤上。我使用Fusion日誌打開並且表明綁定成功,所以現在卡住了。其他任何人都有假貨問題? could not load assembly Logging at C:\src\Application\Development\Main Development Branch\Source\Com

    9熱度

    1回答

    我無法理解如何爲特定通用方法設置墊片。下面是實際的方法簽名: public IEnumerable<TElement> ExecuteQuery<TElement>(TableQuery<TElement> query, TableRequestOptions requestOptions = null, OperationContext operationContext = null) wher

    0熱度

    3回答

    我有一個簡單的「Get」方法。例如: public class Foo : IFoo { public Dictionary<string,string> GetSomething(string xyz) { var result = new Dictionary<string,string> ... Go to DB and return some

    9熱度

    1回答

    我試圖單元測試的一段代碼,會從一個的WebAPI(OData的)控制器調用,並需要在HttpControllerContext: public string MethodToTest(HttpControllerContext context) { string pub = string.Empty; if (context != null) { pu

    4熱度

    1回答

    爲BCL(或任何圖書館)中的類型成員創建墊片時。我們經常面臨一種情況,我們想要調用我們已經使用過的原始方法(無論是在代理內部還是在外部)。例如: - System.Fakes.ShimDateTime.NowGet =() => DateTime.Now.AddDays(-1); 在上面的代碼,所有我們想要做的時候DateTime.Now被稱爲是返回每天比實際日期少。也許這看起來像一個人爲的例

    2熱度

    1回答

    我正在使用Microsoft Fakes和Git。 FakesAssemblies中有文件可以隨時更改(.fakes.dll,.fakesconfig,.messages,.xml)。我可以在我的gitignore中排除哪些。如果我排除了所有內容,我的構建服務器就會說它無法找到這些文件。

    0熱度

    1回答

    有沒有人嘲笑FriendlyUrls單元測試? 我正在寫一個測試,需要模擬asp.net的FriendlyUrls。我需要特別嘲笑的是Request.GetFriendlyUrlSegments()。我正在使用MS Fakes。 這是到目前爲止我的測試: // Arrange var httpContext = TestHelper.StubHtppContext("", "http

    2熱度

    1回答

    我使用微軟假貨內VS2012框架。 我用下面的代碼墊片比如我喜歡的類型的方法。 using (ShimsContext.Create()) { ShimDateTime.NowGet =() => { return new DateTime(1949, 10, 1); }; DateTime now = DateTime.Now; // shim works fo

    1熱度

    1回答

    我有一個WPF視圖模型,有這將打開一個文件對話框像這樣的命令: var dlg = new OpenFileDialog(); var result = dlg.ShowDialog(); 現在我想進行單元測試該命令。 ShowDialog的距離的CommonDialog繼承的方法,所以我認爲我能勻它是這樣的: Microsoft.Win32.Fakes.ShimCommonDialog.A

    1熱度

    1回答

    我正在使用Microsoft Fakes框架來製作一些單元測試存根。 我試圖修改存根行爲StubsBehaviors.DefaultValue根據MSDN link。 但是VS2012一直抱怨它無法解決StubsBehaviors.DefaultValue。我搜索了一下。沒有發現。這似乎是一個枚舉什麼的。它定義了哪個組合?