mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-19 11:08:48 +02:00
127 lines
2.2 KiB
Go
127 lines
2.2 KiB
Go
package model
|
|
|
|
import "testing"
|
|
|
|
func TestModuleDTOGetName(t *testing.T) {
|
|
type fields struct {
|
|
UUID string
|
|
Name string
|
|
Prof string
|
|
Course string
|
|
Semester string
|
|
EventType string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
want string
|
|
}{
|
|
{
|
|
name: "get name",
|
|
fields: fields{
|
|
Name: "name",
|
|
},
|
|
want: "name",
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
m := &ModuleDTO{
|
|
UUID: tt.fields.UUID,
|
|
Name: tt.fields.Name,
|
|
Prof: tt.fields.Prof,
|
|
Course: tt.fields.Course,
|
|
Semester: tt.fields.Semester,
|
|
EventType: tt.fields.EventType,
|
|
}
|
|
if got := m.GetName(); got != tt.want {
|
|
t.Errorf("GetName() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestModuleDTOSetName(t *testing.T) {
|
|
type fields struct {
|
|
UUID string
|
|
Name string
|
|
Prof string
|
|
Course string
|
|
Semester string
|
|
EventType string
|
|
}
|
|
type args struct {
|
|
name string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
args args
|
|
}{
|
|
{
|
|
name: "set name",
|
|
fields: fields{
|
|
Name: "name",
|
|
},
|
|
args: args{
|
|
name: "name",
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
m := &ModuleDTO{
|
|
UUID: tt.fields.UUID,
|
|
Name: tt.fields.Name,
|
|
Prof: tt.fields.Prof,
|
|
Course: tt.fields.Course,
|
|
Semester: tt.fields.Semester,
|
|
EventType: tt.fields.EventType,
|
|
}
|
|
m.SetName(tt.args.name)
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestModuleSetName(t *testing.T) {
|
|
type fields struct {
|
|
UUID string
|
|
Name string
|
|
Prof string
|
|
Course string
|
|
Semester string
|
|
Events Events
|
|
}
|
|
type args struct {
|
|
name string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
args args
|
|
}{
|
|
{
|
|
name: "set name",
|
|
fields: fields{
|
|
Name: "name",
|
|
},
|
|
args: args{
|
|
name: "name",
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
m := &Module{
|
|
UUID: tt.fields.UUID,
|
|
Name: tt.fields.Name,
|
|
Prof: tt.fields.Prof,
|
|
Course: tt.fields.Course,
|
|
Semester: tt.fields.Semester,
|
|
Events: tt.fields.Events,
|
|
}
|
|
m.SetName(tt.args.name)
|
|
})
|
|
}
|
|
}
|