You've already forked linux-packaging-mono
Imported Upstream version 6.6.0.89
Former-commit-id: b39a328747c2f3414dc52e009fb6f0aa80ca2492
This commit is contained in:
parent
cf815e07e0
commit
95fdb59ea6
88
external/api-doc-tools/mdoc/mdoc.Test/StatisticsTests.cs
vendored
Normal file
88
external/api-doc-tools/mdoc/mdoc.Test/StatisticsTests.cs
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
|
||||
using Mono.Documentation.Updater.Statistics;
|
||||
|
||||
namespace mdoc.Test
|
||||
{
|
||||
[TestFixture()]
|
||||
public class StatisticsTests
|
||||
{
|
||||
const string FRAMEWORK_NAME = "frameworkName";
|
||||
|
||||
[Test()]
|
||||
public void StatisticsStorage_Increment()
|
||||
{
|
||||
var statisticsStorage = new StatisticsStorage();
|
||||
|
||||
statisticsStorage.AddMetric(StatisticsItem.Members, StatisticsMetrics.Added);
|
||||
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Members][StatisticsMetrics.Added], 1);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Members][StatisticsMetrics.Removed], 0);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Namespaces][StatisticsMetrics.Added], 0);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Namespaces][StatisticsMetrics.Removed], 0);
|
||||
}
|
||||
|
||||
[Test()]
|
||||
public void StatisticsStorage_ManyIncrements()
|
||||
{
|
||||
var statisticsStorage = new StatisticsStorage();
|
||||
|
||||
statisticsStorage.AddMetric(StatisticsItem.Members, StatisticsMetrics.Added);
|
||||
statisticsStorage.AddMetric(StatisticsItem.Members, StatisticsMetrics.Added);
|
||||
statisticsStorage.AddMetric(StatisticsItem.Members, StatisticsMetrics.Added);
|
||||
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Members][StatisticsMetrics.Added], 3);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Members][StatisticsMetrics.Removed], 0);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Namespaces][StatisticsMetrics.Added], 0);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Namespaces][StatisticsMetrics.Removed], 0);
|
||||
}
|
||||
|
||||
[Test()]
|
||||
public void StatisticsStorage_IncrementDelta()
|
||||
{
|
||||
var statisticsStorage = new StatisticsStorage();
|
||||
|
||||
statisticsStorage.AddMetric(StatisticsItem.Members, StatisticsMetrics.Added, 5);
|
||||
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Members][StatisticsMetrics.Added], 5);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Members][StatisticsMetrics.Removed], 0);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Namespaces][StatisticsMetrics.Added], 0);
|
||||
Assert.AreEqual(statisticsStorage.Values[StatisticsItem.Namespaces][StatisticsMetrics.Removed], 0);
|
||||
}
|
||||
|
||||
[Test()]
|
||||
public void StatisticsCollector_Increment()
|
||||
{
|
||||
var statisticsCollector = new StatisticsCollector();
|
||||
|
||||
statisticsCollector.AddMetric(FRAMEWORK_NAME, StatisticsItem.Members, StatisticsMetrics.Added);
|
||||
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Members][StatisticsMetrics.Added], 1);
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Members][StatisticsMetrics.Removed], 0);
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Namespaces][StatisticsMetrics.Added], 0);
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Namespaces][StatisticsMetrics.Removed], 0);
|
||||
}
|
||||
|
||||
[Test()]
|
||||
public void StatisticsCollector_IncrementDelta()
|
||||
{
|
||||
var statisticsCollector = new StatisticsCollector();
|
||||
|
||||
statisticsCollector.AddMetric(FRAMEWORK_NAME, StatisticsItem.Members, StatisticsMetrics.Added, 7);
|
||||
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Members][StatisticsMetrics.Added], 7);
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Members][StatisticsMetrics.Removed], 0);
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Namespaces][StatisticsMetrics.Added], 0);
|
||||
Assert.AreEqual(
|
||||
statisticsCollector.Storages[FRAMEWORK_NAME].Values[StatisticsItem.Namespaces][StatisticsMetrics.Removed], 0);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user