public void GetAll_returns_preexisting_app() { var clientRepository = new ClientInMemoryRepository(); var client = new Client("Client Name", "John", "1234567890", "*****@*****.**"); clientRepository.Store(client); var repository = new UserInMemoryRepository(clientRepository); var user1 = new User(new UserDto { Id = Guid.NewGuid(), ClientId = client.Identifier.Identity, Username = "******", Password = "******", FirstName = "John", LastName = "Doe", EmailAddress = "*****@*****.**" }); var user2 = new User(new UserDto { Id = Guid.NewGuid(), ClientId = client.Identifier.Identity, Username = "******", Password = "******", FirstName = "John", LastName = "Doe", EmailAddress = "*****@*****.**" }); var user3 = new User(new UserDto { Id = Guid.NewGuid(), ClientId = client.Identifier.Identity, Username = "******", Password = "******", FirstName = "John", LastName = "Doe", EmailAddress = "*****@*****.**" }); repository.Store(user1); repository.Store(user2); repository.Store(user3); var list = repository.All(); list.Any(u => u.UserId.Equals(user1.Identifier.Id)).ShouldBeTrue(); list.Any(u => u.UserId.Equals(user2.Identifier.Id)).ShouldBeTrue(); list.Any(u => u.UserId.Equals(user3.Identifier.Id)).ShouldBeTrue(); list.Count.ShouldBe(3); }
public void StoreAndGetByIdentifier_stores_and_gets_application() { var repository = new UserInMemoryRepository(new ClientInMemoryRepository()); var user = new User(new UserDto { Id = Guid.NewGuid(), ClientId = Guid.NewGuid(), Username = "******", Password = "******", FirstName = "John", LastName = "Doe", EmailAddress = "*****@*****.**" }); repository.Store(user); var reconstitutedUser = repository.GetByIdentifier(user.Identifier); user.Identifier.ShouldBe(reconstitutedUser.Identifier); user.ClientIdentifier.ShouldBe(reconstitutedUser.ClientIdentifier); user.LoginInfo.ShouldBe(reconstitutedUser.LoginInfo); user.Name.ShouldBe(reconstitutedUser.Name); user.Email.ShouldBe(reconstitutedUser.Email); }