| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package mockapp
- import (
- "context"
- "sync"
- "wartank/pkg/mock/mockkernel"
- "wartank/pkg/types"
- )
- type MockApp struct {
- *mockkernel.MockKernel
- fnCancel func()
- ctx context.Context
- bot types.IWarBot
- store types.IStore
- block *sync.RWMutex
- }
- func NewMockApp() *MockApp {
- ctxBg := context.Background()
- ctx, fnCancel := context.WithCancel(ctxBg)
- sf := &MockApp{
- MockKernel: mockkernel.NewMockKernel(),
- ctx: ctx,
- fnCancel: fnCancel,
- block: &sync.RWMutex{},
- }
- return sf
- }
- func (sf *MockApp) Store() types.IStore {
- return sf.store
- }
- func (sf *MockApp) Bot() types.IWarBot {
- return sf.bot
- }
- func (sf *MockApp) Angar() types.IAngar {
- return nil
- }
- func (sf *MockApp) CtxApp() context.Context {
- return sf.ctx
- }
- func (sf *MockApp) Tank() types.ITank {
- return nil
- }
- func (sf *MockApp) Run() error {
- return nil
- }
- func (sf *MockApp) CancelApp() {
- go sf.fnCancel()
- }
- func (sf *MockApp) Block() *sync.RWMutex {
- return sf.block
- }
- func (sf *MockApp) NetClient() types.IBotNet {
- return nil
- }
- func (sf *MockApp) ServBots() types.IServBots {
- return nil
- }
|