forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring_nil_save_changes_test.go
54 lines (41 loc) · 1004 Bytes
/
string_nil_save_changes_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package tests
import (
"testing"
"github.com/stretchr/testify/assert"
)
// Note: must rename as it conflicts with Order in order_test.go
type CustomerNilReference struct {
ID string `json:"Id"`
Reference *string `json:"reference"`
Name string `json:"name"`
}
func TestStringNilError(t *testing.T) {
driver := createTestDriver(t)
test_case_string_nil_error(t, driver)
}
func test_case_string_nil_error(t *testing.T, driver *RavenTestDriver) {
id := "customer1"
reference := "reference"
var err error
store := driver.getDocumentStoreMust(t)
defer store.Close()
obj := &CustomerNilReference{
ID: id,
Name: "customer_name",
}
{
session := openSessionMust(t, store)
err = session.Store(obj)
assert.NoError(t, err)
session.SaveChanges()
session.Close()
}
{
session := openSessionMust(t, store)
var customer *CustomerNilReference
err = session.Load(&customer, id)
customer.Reference = &reference
session.SaveChanges()
session.Close()
}
}