AudioSystem() public method

public AudioSystem ( bool newInstance = false ) : Mock
newInstance bool
return Mock
Esempio n. 1
0
        public void Init()
        {
            _mocks    = Mocks.Init();
            _resolver = Mocks.GetResolver();
            _resolver.Build();
            var updater = new ContainerBuilder();

            updater.RegisterInstance(_mocks.Input().Object).As <IInput>();
            updater.RegisterInstance(_mocks.AudioSystem().Object).As <IAudioSystem>();
            updater.RegisterInstance(new Mock <IMessagePump>().Object);
            updater.RegisterInstance(new Mock <IRuntimeSettings>().Object);
            Mock <IUIThread> uiThread = new Mock <IUIThread>();

            uiThread.Setup(u => u.RunBlocking(It.IsAny <Action>())).Callback <Action>(a => a());
            updater.RegisterInstance(uiThread.Object);
            updater.Update(_resolver.Container);
            _textures = new Dictionary <string, ITexture> ();
            _state    = _resolver.Container.Resolve <IGameState>();
            _factory  = _resolver.Container.Resolve <IGameFactory>();
            DesktopFileSystem fileSystem = new DesktopFileSystem();

            _saveLoad = new AGSSaveLoad(_resolver, _factory, _textures, _resolver.Container.Resolve <IGame>(),
                                        fileSystem);
            _state.Rooms.Add(_mocks.Room().Object);
        }
Esempio n. 2
0
        public static Mocks Init()
        {
            ContainerBuilder builder = new ContainerBuilder();
            Mocks            mocks   = new Mocks();

            builder.RegisterInstance(mocks.Animation().Object);
            builder.RegisterInstance(mocks.AnimationState().Object);
            builder.RegisterInstance(mocks.GameState().Object);
            builder.RegisterInstance(mocks.Game().Object);
            builder.RegisterInstance(mocks.Player().Object);
            builder.RegisterInstance(mocks.Character().Object);
            builder.RegisterInstance(mocks.Room().Object);
            builder.RegisterInstance(mocks.Object().Object);
            builder.RegisterInstance(mocks.Viewport().Object);
            builder.RegisterInstance(mocks.Sprite().Object);
            builder.RegisterInstance(mocks.Image().Object);
            builder.RegisterInstance(mocks.Input().Object);
            builder.RegisterInstance(mocks.Cutscene().Object);
            builder.RegisterInstance(mocks.RoomTransitions().Object);
            builder.RegisterInstance(mocks.AudioSystem().Object);
            builder.RegisterInstance(new Mock <IRenderMessagePump> ().Object);
            builder.RegisterInstance(new Mock <IUpdateMessagePump>().Object);
            builder.RegisterInstance(new Mock <IGameEvents>().Object);
            builder.RegisterInstance(new Mock <IDisplayList>().Object);
            builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());

            mocks.container = builder.Build();

            return(mocks);
        }