2020-05-11 09:01:28 +00:00
|
|
|
package entity
|
2020-05-08 13:41:01 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2022-04-10 12:38:51 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2020-05-08 13:41:01 +00:00
|
|
|
)
|
|
|
|
|
2022-04-10 12:38:51 +00:00
|
|
|
func TestCount(t *testing.T) {
|
|
|
|
m := PhotoFixtures.Pointer("Photo01")
|
|
|
|
_, keys, err := ModelValues(m, "ID", "PhotoUID")
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
result := Count(m, []string{"ID", "PhotoUID"}, keys)
|
|
|
|
|
|
|
|
assert.Equal(t, 1, result)
|
|
|
|
}
|