3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Power Assert .NETをVB.NETで使ってみたかった

3
Posted at

power-assertの.NET版は無いのか!と思ってググってみたところ
なんと見つかったので試しに使ってみた。
https://powerassert.codeplex.com/

感想

どうにか使えなくもないけど、結果表示が微妙・・・

やったこと

1.新しいプロジェクトを作り、テストプロジェクトを追加する。

2.PowerAssertのDLLをダウンロードして、テストプロジェクトに追加

3.PowerAssertのページで紹介されているC#のコードをVB.NETに翻訳
https://powerassert.codeplex.com/

VB.Net
Imports System.Text
Imports PowerAssert

<TestClass()>
Public Class UnitTest1

    <TestMethod()>
    Public Sub RunComplexExpression()
        Dim x = 11
        Dim y = 6

        Dim d = New DateTime(2010, 3, 1)

        PAssert.IsTrue(Function() x + 5 = d.Month * y)
    End Sub

End Class

4.テスト実行!!

出力結果

テスト失敗すると例外が投げられて、エラーメッセージにPowerAssertの出力結果が格納されている。↓こんな感じ。
image

ずれてる!!しかも横に長い!!!
ずれてるのはフォントの問題だとしても、
無名関数外の変数名が分かりにくくて、何かキモい。
C#向けのライブラリだからしょうがないんだろうけど、使っていくかは微妙です。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?