示例#1
0
        public void LoadAccounts_RequestForLoadAccount_LoadAccount()
        {
            _mockService   = Mock.Create <ISettings>();
            _parameterName = "accountSettings";
            _settings      = new AccountSettings(_mockService.Object, _parameterName);

            string stub =
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<ArrayOfAccountSettingsItem xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n  <AccountSettingsItem>\r\n    <Login>myLogin</Login>\r\n    <Token>123</Token>\r\n    <ServerName>Yandex</ServerName>\r\n  </AccountSettingsItem>\r\n</ArrayOfAccountSettingsItem>";
            var expected = new[]
            {
                new AccountSettingsItem()
                {
                    Login = "******", ServerName = "Yandex", Token = "123"
                },
            };

            _mockService.Setup(settings => settings.GetValueAsString(_parameterName)).Returns(stub);
            IAccountSettingsItem[] actuality = _settings.LoadAccounts();
            CollectionAssert.AreEqual(expected, actuality);
        }