예제 #1
0
        public void CanGetEntityByIdNotFound()
        {
            // Arrange
            var conn = GetConnectionString();
            var repo = new SqliteUserRepository(conn);

            // Act
            var result = repo.GetById(0);

            // Assert
            Assert.IsFalse(result.IsValid);
        }
예제 #2
0
        public void CanGetEntityById()
        {
            // Arrange
            var conn        = GetConnectionString();
            var repo        = new SqliteUserRepository(conn);
            var entity      = new User(0, "email", new byte[] { 0x1, 0x2 }, "Name");
            var savedEntity = repo.AddOrUpdate(entity);

            // Act
            var result = repo.GetById(savedEntity.Value.Id);

            // Assert
            Assert.IsTrue(result.IsValid);
            Assert.IsTrue(result.Value.Equals(savedEntity.Value));
        }