Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Move assert
Browse files Browse the repository at this point in the history
  • Loading branch information
michellemcdaniel committed Nov 2, 2017
1 parent caa72fb commit 5b401fb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
10 changes: 2 additions & 8 deletions src/System.Diagnostics.PerformanceCounter/tests/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ public static string CreateCategory(string name, PerformanceCounterCategoryType
DeleteCategory(name);
PerformanceCounterCategory.Create(category, "description", categoryType, name, "counter description");

if (PerformanceCounterCategoryCreated(category))
{
return category;
}
else
{
return null;
}
Assert.True(PerformanceCounterCategoryCreated(category));
return category;
}

public static bool PerformanceCounterCategoryCreated(string category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public static void PerformanceCounterCategory_CategoryType_MultiInstance()
var name = nameof(PerformanceCounterCategory_CategoryType_MultiInstance) + "_Counter";

var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.MultiInstance);
Assert.NotNull(category);

PerformanceCounterCategory pcc = new PerformanceCounterCategory(category);

Expand All @@ -99,7 +98,6 @@ public static void PerformanceCounterCategory_CategoryType_SingleInstance()
var name = nameof(PerformanceCounterCategory_CategoryType_SingleInstance) + "_Counter";

var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.SingleInstance);
Assert.NotNull(category);

PerformanceCounterCategory pcc = new PerformanceCounterCategory(category);

Expand Down Expand Up @@ -213,7 +211,6 @@ public static void PerformanceCounterCategory_DeleteCategory()
{
var name = nameof(PerformanceCounterCategory_DeleteCategory) + "_Counter";
var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.SingleInstance);
Assert.NotNull(category);

PerformanceCounterCategory.Delete(category);

Expand All @@ -233,7 +230,6 @@ public static void PerformanceCounterCategory_GetCounters()
{
var name = nameof(PerformanceCounterCategory_GetCounters) + "_Counter";
var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.SingleInstance);
Assert.NotNull(category);

PerformanceCounterCategory pcc = new PerformanceCounterCategory(category);
PerformanceCounter[] counters = pcc.GetCounters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public static void PerformanceCounter_CreateCounter_MultiInstanceReadOnly()

var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.MultiInstance);

Assert.NotNull(category);

using (PerformanceCounter counterSample = new PerformanceCounter(category, name, instance))
{
Assert.Equal(name, counterSample.CounterName);
Expand All @@ -76,7 +74,6 @@ public static void PerformanceCounter_CreateCounter_SetReadOnly()
var name = nameof(PerformanceCounter_CreateCounter_SetReadOnly) + "_Counter";

var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.SingleInstance);
Assert.NotNull(category);

using (PerformanceCounter counterSample = new PerformanceCounter(category, name))
{
Expand Down Expand Up @@ -280,7 +277,6 @@ public static void PerformanceCounter_NextSample_MultiInstance()
var instance = name + "_Instance";

var category = Helpers.CreateCategory(name, PerformanceCounterCategoryType.MultiInstance);
Assert.NotNull(category);

using (PerformanceCounter counterSample = new PerformanceCounter(category, name, instance, false))
{
Expand All @@ -295,7 +291,6 @@ public static void PerformanceCounter_NextSample_MultiInstance()
public static PerformanceCounter CreateCounterWithCategory(string name, bool readOnly, PerformanceCounterCategoryType categoryType )
{
var category = Helpers.CreateCategory(name, categoryType);
Assert.NotNull(category);

PerformanceCounter counterSample = new PerformanceCounter(category, name, readOnly);

Expand Down

0 comments on commit 5b401fb

Please sign in to comment.