public void ReturnSpecialMessage_GivenNoAnalyticsDataYet() { TopCommandsOperation topCommandsOperation = SetUpTest(new List <CommandUsageEntity>()); string messageResult = topCommandsOperation.TryToExecute(new CommandReceivedEventArgs()); messageResult.Should().Be(TopCommandsOperation.NO_DATA_MESSAGE); }
private static TopCommandsOperation SetUpTest(List <CommandUsageEntity> commandUsageEntities) { var mockRepo = new Mock <IRepository>(); mockRepo.Setup(x => x.List <CommandUsageEntity>(null)).Returns(commandUsageEntities); var topCommandsOperation = new TopCommandsOperation(mockRepo.Object); return(topCommandsOperation); }
public void ReturnOnlyTopFiveCommands_GivenDataForMoreThanFiveCommands() { var fullTypeName = Guid.NewGuid().ToString(); List <CommandUsageEntity> entities = GetTestEntities(fullTypeName, "1", "2", "3", "4", "5"); TopCommandsOperation topCommandsOperation = SetUpTest(entities); string messageResult = topCommandsOperation.TryToExecute(new CommandReceivedEventArgs()); messageResult.Should().NotContain(fullTypeName); }
public void DisplayOnlyNameOfType() { string name = "Foo"; string notIncluded = "Buzz"; var entities = new List <CommandUsageEntity> { new CommandUsageEntity { FullTypeName = $"Bar.Fizz.{notIncluded}.{name}" } }; TopCommandsOperation topCommandsOperation = SetUpTest(entities); string messageResult = topCommandsOperation.TryToExecute(new CommandReceivedEventArgs()); messageResult.Should().Contain(name); messageResult.Should().NotContain(notIncluded); }
public void ReturnSingleEntry_GivenSameCommandAnalyticsData() { var fullTypeName = Guid.NewGuid().ToString(); var entities = new List <CommandUsageEntity> { new CommandUsageEntity { FullTypeName = fullTypeName }, new CommandUsageEntity { FullTypeName = fullTypeName }, new CommandUsageEntity { FullTypeName = fullTypeName } }; TopCommandsOperation topCommandsOperation = SetUpTest(entities); string messageResult = topCommandsOperation.TryToExecute(new CommandReceivedEventArgs()); messageResult.Should().Contain(fullTypeName); }
public void ReturnMultipleEntries_GivenMultipleCommandsData() { var fullTypeName1 = Guid.NewGuid().ToString(); var fullTypeName2 = Guid.NewGuid().ToString(); var entities = new List <CommandUsageEntity> { new CommandUsageEntity { FullTypeName = fullTypeName1 }, new CommandUsageEntity { FullTypeName = fullTypeName2 } }; TopCommandsOperation topCommandsOperation = SetUpTest(entities); string messageResult = topCommandsOperation.TryToExecute(new CommandReceivedEventArgs()); messageResult.Should().Contain(fullTypeName1); messageResult.Should().Contain(fullTypeName2); }