jeudi 3 mars 2016

How to test if funtion does not throw exception?

I have this test:

[Test]
[Category(Helper.TEST_CATEGORY_SAVE_FOR_WEB)]
public void SaveForWebTest ()
{
    // arrange
    var slgdController = FakeSaveLoadGameDataController();
    TestDelegate myDelegate = () => {};

    // act
    slgdController.SaveForWeb();

    // assert
    Assert.DoesNotThrow(myDelegate);
}

But I feel there is no connection between the assertion and the call of SaveForWeb() function.

Is this the right way to assert if function does not throw exception?

Aucun commentaire:

Enregistrer un commentaire