public async Task Return_all_the_content_that_exists() { // arrange var request = new StaticCommandsLookup(); var commands = new ValidStaticCommands { Commands = new List <StaticCommandInfo> { new StaticCommandInfo { Command = "foo", Content = "bar" }, new StaticCommandInfo { Command = "foo2", Content = "bar2" }, } }; MockCollection.Setup(x => x.GetAsync("staticContentCommands", null)) .ReturnsAsync(new FakeGetResult(commands)); // act var result = await _handler.Handle(request, CancellationToken.None); // assert Assert.That(result, Is.Not.Null); Assert.That(result.Commands, Is.Not.Null); Assert.That(result.Commands.Any(), Is.True); Assert.That(result.Commands.Count, Is.EqualTo(commands.Commands.Count)); }
public async Task Return_all_the_content_that_exists() { // arrange var request = new StaticCommandsLookup(); var commands = new ValidStaticCommands { Commands = new List <StaticCommandInfo> { new StaticCommandInfo { Command = "foo", Content = "bar" }, new StaticCommandInfo { Command = "foo2", Content = "bar2" }, } }; _mockBucket.Setup(x => x.GetAsync <ValidStaticCommands>("staticContentCommands")) .ReturnsAsync(new FakeOperationResult <ValidStaticCommands> { Success = true, Value = commands }); // act var result = await _handler.Handle(request, CancellationToken.None); // assert Assert.That(result, Is.Not.Null); Assert.That(result.Commands, Is.Not.Null); Assert.That(result.Commands.Any(), Is.True); Assert.That(result.Commands.Count, Is.EqualTo(commands.Commands.Count)); }
public async Task Return_empty_list_if_there_are_no_commands_stored_in_database() { // arrange var request = new StaticCommandsLookup(); MockCollection.Setup(x => x.GetAsync("staticContentCommands", null)) .Throws <Exception>(); // act var result = await _handler.Handle(request, CancellationToken.None); // assert Assert.That(result, Is.Not.Null); Assert.That(result.Commands == null || !result.Commands.Any(), Is.True); }
public async Task Return_empty_list_if_there_are_no_commands_stored_in_database() { // arrange var request = new StaticCommandsLookup(); _mockBucket.Setup(x => x.GetAsync <ValidStaticCommands>("staticContentCommands")) .ReturnsAsync(new FakeOperationResult <ValidStaticCommands> { Success = false }); // act var result = await _handler.Handle(request, CancellationToken.None); // assert Assert.That(result, Is.Not.Null); Assert.That(result.Commands == null || !result.Commands.Any(), Is.True); }