public void Find_RequestForFindAccount_FindAccount() { var accountSettingsStub = new[] { new AccountSettingsItem() { Login = expectedLogin, ServerName = expectedServerName, Token = expectedToken }, new AccountSettingsItem() { Login = "******", ServerName = "Tandex", Token = "9875452" }, }; _mockAccountSettings.SetupGet(settings => settings.LoadAccounts()).Returns(accountSettingsStub); _accountRegistry = new AccountRegistry(_mockAccountSettings.Object, _accountContainerStub); _accountRegistry.Load(); IAccountProjection accountFound = _accountRegistry.Find(expectedLogin); _mockAccount.VerifySet(acc => acc.Login, expectedLogin, Occurred.Once()); _mockAccount.VerifySet(acc => acc.Token, expectedToken, Occurred.Once()); Assert.AreEqual(expectedLogin, accountFound.Login); Assert.AreEqual(expectedServerName, accountFound.ServerName); Assert.AreEqual(expectedToken, accountFound.Token); Assert.IsNotNull(accountFound); }
public void Load_RequestForLoadSetting_LoadSettings() { var accountSettingsStub = new[] { new AccountSettingsItem() { Login = expectedLogin, ServerName = expectedServerName, Token = expectedToken }, }; _mockAccountSettings.SetupGet(settings => settings.LoadAccounts()).Returns(accountSettingsStub); _accountRegistry = new AccountRegistry(_mockAccountSettings.Object, _accountContainerStub); _accountRegistry.LoadedEvent += (o, e) => { Assert.IsNotNull(e.Accounts); Assert.AreEqual(e.Accounts.Length, 1); _mockAccount.Verify(acc => acc.LoadConnector(expectedServerName), Occurred.Once()); _mockAccount.VerifySet(acc => acc.Login, expectedLogin, Occurred.Once()); _mockAccount.VerifySet(acc => acc.Token, expectedToken, Occurred.Once()); Assert.AreEqual(e.Size, expectedSize); }; _accountRegistry.Load(); }