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 Registry_RequestForRegistrationAccount_RegistryAccount() { _mockAccountSettings.SetupGet(settings => settings.LoadAccounts()).Returns(Array.Empty <IAccountSettingsItem>()); _accountRegistry = new AccountRegistry(_mockAccountSettings.Object, _accountContainerStub); _accountRegistry.Registry(_mockAccount.Object); Assert.AreEqual(_accountRegistry.Size, expectedSize); IAccountProjection accountFound = _accountRegistry.Find(expectedLogin); Assert.IsNotNull(accountFound); }
public void Delete_RequestForDeletion_DeleteAccount() { _mockAccountSettings.SetupGet(settings => settings.LoadAccounts()).Returns(Array.Empty <IAccountSettingsItem>()); _accountRegistry = new AccountRegistry(_mockAccountSettings.Object, _accountContainerStub); _accountRegistry.Registry(_mockAccount.Object); Assert.IsTrue(_accountRegistry.Delete(expectedLogin)); Assert.AreEqual(_accountRegistry.Size, new SpaceSize()); IAccountProjection accountFound = _accountRegistry.Find(expectedLogin); Assert.IsNull(accountFound); }