<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kuxumarin</author_name>
  <author_url>https://blog.hatena.ne.jp/kuxumarin/</author_url>
  <blog_title>くうと徒然なるままに</blog_title>
  <blog_url>https://kuxumarin.hatenablog.com/</blog_url>
  <categories>
    <anon>ASP.NET Core</anon>
    <anon>C#</anon>
  </categories>
  <description>ASP.NET Core の Controller で IActionResult な戻り値になっている関数はよくあります。 そんな Controller の戻り値を単体テストで呼び出すときに ステータスコードを判定したい というのはよくあると思います。 解決方法 Controller のメソッドの戻り値を OK(200) の場合は、 OkObjectResult にキャストします。 C# の is キーワードを使うことで、キャストできるか判定することができます。 コード public class hoge { public class HogeController { [HttpGet()]…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkuxumarin.hatenablog.com%2Fentry%2F2018%2F01%2F26%2F171628&quot; title=&quot;ASP.NET Core の単体テストで IActionResult からステータスコードを判定する - くうと徒然なるままに&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-01-26 17:16:28</published>
  <title>ASP.NET Core の単体テストで IActionResult からステータスコードを判定する</title>
  <type>rich</type>
  <url>https://kuxumarin.hatenablog.com/entry/2018/01/26/171628</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
