-
Notifications
You must be signed in to change notification settings - Fork 315
/
BaseTestRunCriteriaTests.cs
67 lines (55 loc) · 2.01 KB
/
BaseTestRunCriteriaTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.TestPlatform.ObjectModel.UnitTests.Client;
[TestClass]
public class BaseTestRunCriteriaTests
{
[TestMethod]
public void ConstructorShouldThrowIfFrequencyOfRunStatsChangeIsZero()
{
var isExceptionThrown = false;
try
{
var criteria = new BaseTestRunCriteria(frequencyOfRunStatsChangeEvent: 0);
}
catch (ArgumentOutOfRangeException ex)
{
isExceptionThrown = true;
StringAssert.Contains(ex.Message, "Notification frequency need to be a positive value.");
}
Assert.IsTrue(isExceptionThrown);
}
[TestMethod]
public void ConstructorShouldThrowIfFrequencyOfRunStatsChangeIsLesssThanZero()
{
var isExceptionThrown = false;
try
{
var criteria = new BaseTestRunCriteria(frequencyOfRunStatsChangeEvent: -10);
}
catch (ArgumentOutOfRangeException ex)
{
isExceptionThrown = true;
StringAssert.Contains(ex.Message, "Notification frequency need to be a positive value.");
}
Assert.IsTrue(isExceptionThrown);
}
[TestMethod]
public void ConstructorShouldThrowIfRunStatsChangeEventTimeoutIsMinimumTimeSpanValue()
{
var isExceptionThrown = false;
try
{
var criteria = new BaseTestRunCriteria(frequencyOfRunStatsChangeEvent: 1, keepAlive: false, testSettings: null, runStatsChangeEventTimeout: TimeSpan.MinValue);
}
catch (ArgumentOutOfRangeException ex)
{
isExceptionThrown = true;
StringAssert.Contains(ex.Message, "Notification timeout must be greater than zero.");
}
Assert.IsTrue(isExceptionThrown);
}
}