Implemented Telemetry class via an interface for test ease

This commit is contained in:
Lakshan Fernando 2016-03-31 16:37:40 -07:00 committed by Dan Quirk
parent d9e169e77a
commit 25745d9d4e
4 changed files with 75 additions and 20 deletions

View file

@ -0,0 +1,35 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
using FluentAssertions;
namespace Microsoft.DotNet.Tests
{
public class MockTelemetry : ITelemetry
{
public string EventName{get;set;}
public void TrackEvent(string eventName, IDictionary<string, string> properties, IDictionary<string, double> measurements)
{
EventName = eventName;
}
}
public class TelemetryCommandTests : TestBase
{
[Fact]
public void TestProjectDependencyIsNotAvailableThroughDriver()
{
Program program = new Program();
MockTelemetry mockTelemetry = new MockTelemetry();
string[] args = { "help" };
program.ProcessArgs(args, mockTelemetry);
Assert.Equal(mockTelemetry.EventName, args[0]);
}
}
}