/// <summary>
        ///     Default contructor
        /// </summary>
        public DaemonHostTestBase()
        {
            LoggerMock                = new LoggerMock();
            DefaultHassClientMock     = HassClientMock.DefaultMock;
            DefaultDataRepositoryMock = new Mock <IDataRepository>();
            DefaultHttpHandlerMock    = new HttpHandlerMock();
            var hassClientFactoryMock = new HassClientFactoryMock(DefaultHassClientMock);

            DefaultDaemonHost = new NetDaemonHost(
                hassClientFactoryMock.Object,
                DefaultDataRepositoryMock.Object,
                LoggerMock.LoggerFactory,
                DefaultHttpHandlerMock.Object,
                DefaultServiceProviderMock.Object
                )
            {
                InternalDelayTimeForTts = 0 // Allow no extra waittime
            };
        }
示例#2
0
        /// <summary>
        ///     Default contructor
        /// </summary>
        public DaemonHostTestBase()
        {
            LoggerMock                = new LoggerMock();
            DefaultHassClientMock     = HassClientMock.DefaultMock;
            DefaultDataRepositoryMock = new Mock <IDataRepository>();
            DefaultHttpHandlerMock    = new HttpHandlerMock();
            var hassClientFactoryMock = new HassClientFactoryMock(DefaultHassClientMock);

            // The DefaultNetDaemonHost is created lazy so new services could be added to the ServiceCollection before
            // it is created
            _LazyDefaultDaemonHost = new Lazy <NetDaemonHost>(
                () => new NetDaemonHost(
                    hassClientFactoryMock.Object,
                    DefaultDataRepositoryMock.Object,
                    LoggerMock.LoggerFactory,
                    DefaultHttpHandlerMock.Object,
                    DefaultServiceCollection.BuildServiceProvider()
                    )
                // Allow no extra wait time
            {
                TextToSpeechService = { InternalDelayTimeForTts = 0 }
            });
        }