Datenbank/kunde/meldung_test.go

18 lines
577 B
Go

package kunde
import (
"testing"
)
func TestMeldungRepo(t *testing.T) {
m := NewMeldungsRepository()
m.AddAmount(1)
if len(m.GetAllAmount()) != 1 || m.GetAllAmount()[0].Id != 1 {
t.Errorf("Error, Element of first Meldung should have id %d, but has %d", 1, m.GetAllAmount()[0].Id)
}
m.AddAmount(20)
if len(m.GetAllAmount()) != 2 || m.GetAllAmount()[1].Id != 2 || m.GetAllAmount()[1].Data != 20 {
t.Errorf("Error, Element of second Meldung should have id %d, but has %d, and amount should be 20, but is %d", 1, m.GetAllAmount()[0].Id, m.GetAllAmount()[1].Data)
}
}