public void CreateCurrentAccountWithBadArgumentsThrowsException(string currencyId, string displayName) { var service = new ClientService { Container = this.container }; var sessionId = Guid.NewGuid(); try { service.CreateCurrentAccount(sessionId, currencyId, displayName); } catch (ArgumentException) { return; } Assert.Fail(); }
public void CreateCurrentAccountWithoutCredentialsThrowsException() { // Arrange var service = new ClientService { Container = this.container }; // Act and assert Assert.Throws<ArgumentException>(() => service.CreateCurrentAccount(Guid.Empty, "*****@*****.**", null)); }
public void CreateAccountWithGoodCredentialsDoesNotThrowException(string currencyId, string displayName) { // Arrange var context = new Mock<IOliveContext>(); this.container.RegisterInstance(context.Object); var service = new ClientService { Container = this.container }; var sessionId = Guid.NewGuid(); var expectedAccountId = 53; var userId = 512; context.Setup(c => c.VerifySession(sessionId)).Returns(userId); // Create account should convert empty strings to null because it's not appropriate in the database. context.Setup( c => c.CreateCurrentAccount(userId, currencyId, displayName == string.Empty ? null : displayName)). Returns(expectedAccountId); // Act var actualAccountId = service.CreateCurrentAccount(sessionId, currencyId, displayName); // Assert Assert.AreEqual(expectedAccountId, actualAccountId); }