private static ShipstationController GetShipstationController() { var avalaraUsername = "******"; var avalaraPassword = "******"; var avalaraServiceUrl = "https://development.avalara.net"; const string _usernamePropertyName = "Avalara.Tax.Credentials.AccountNumber"; const string _passwordPropertyName = "Avalara.Tax.Credentials.LicenseKey"; const string _serviceUrlPropertyName = "Avalara.Tax.Credentials.ServiceUrl"; var settings = new List <SettingEntry> { new SettingEntry { Value = avalaraUsername, Name = _usernamePropertyName, ValueType = SettingValueType.ShortText }, new SettingEntry { Value = avalaraPassword, Name = _passwordPropertyName, ValueType = SettingValueType.ShortText }, new SettingEntry { Value = avalaraServiceUrl, Name = _serviceUrlPropertyName, ValueType = SettingValueType.ShortText } }; var settingsManager = new Moq.Mock <ISettingsManager>(); settingsManager.Setup(manager => manager.GetValue(_usernamePropertyName, string.Empty)).Returns(() => settings.First(x => x.Name == _usernamePropertyName).Value); settingsManager.Setup(manager => manager.GetValue(_passwordPropertyName, string.Empty)).Returns(() => settings.First(x => x.Name == _passwordPropertyName).Value); settingsManager.Setup(manager => manager.GetValue(_serviceUrlPropertyName, string.Empty)).Returns(() => settings.First(x => x.Name == _serviceUrlPropertyName).Value); var shipstationSettings = new ShipstationSettings(_usernamePropertyName, _passwordPropertyName, _serviceUrlPropertyName, settingsManager.Object); var orderSearchService = new Mock <ICustomerOrderSearchService>(); orderSearchService.Setup(service => service.Search(It.IsAny <SearchCriteria>())) .Returns(() => new SearchResult { CustomerOrders = new List <CustomerOrder> { GetTestOrder("123") } }); var orderService = new Mock <ICustomerOrderService>(); var controller = new ShipstationController(shipstationSettings, orderService.Object, orderSearchService.Object); return(controller); }
public ShipstationTest() { _controller = GetShipstationController(); }