public async Task TestConfigFailure(string fileName, Strings expectedMessage) { var client = A.Fake <IStoreClient>(); var logger = new MockLogger(); var stringprovider = new StringProvider(); var command = new MockCommandBase(client, logger, stringprovider); var options = new OptionsBase { ConfigFile = $"{this.GetExecutingPath()}\\Files\\{fileName}" }; var result = await command.DoCommand(options); logger.Message.ElementAt(logger.Message.Count - 2).Should().Be(string.Format(stringprovider.GetString(expectedMessage), options.ConfigFile), "because there is something wrong with the config file"); result.Should().BeNegative("the config file is invalid"); }
public async Task TestLoginSuccess() { var client = A.Fake <IStoreClient>(); A.CallTo(() => client.Login("myId", "myKey", "myTenantId")).Returns(Task.Factory.StartNew(() => true)); var logger = new MockLogger(); var stringprovider = new StringProvider(); var command = new MockCommandBase(client, logger, stringprovider); var options = new OptionsBase { ConfigFile = $"{this.GetExecutingPath()}\\Files\\.valid_config" }; var result = await command.DoCommand(options); result.Should().BeGreaterOrEqualTo(0, "client credentials do not match"); A.CallTo(() => client.Login("myId", "myKey", "myTenantId")).MustHaveHappened(); }