Ejemplo n.º 1
0
        public async Task SetCurrentAsync_ValidProxyControllerValidSlaveClient_CallsSlaveClient()
        {
            IBackendAsync backend = new LocalBackend(null, proxyController, slaveClient);
            await backend.SetCurrentAsync("name").ConfigureAwait(false);

            await slaveClient.Received().SetCurrentEntryAsync(Arg.Is("name")).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
        public async Task SetCurrentAsync_ValidProxyController_CallsProxyController()
        {
            IBackendAsync backend = new LocalBackend(null, proxyController, null);
            await backend.SetCurrentAsync("name").ConfigureAwait(false);

            await proxyController.Received().SetCurrentEntryAsync(Arg.Is("name")).ConfigureAwait(false);
        }
Ejemplo n.º 3
0
        public async Task SetCurrentAsync_CurrentChanges_RaisesCurrentChangedEvent()
        {
            var           wasCalled = false;
            IBackendAsync backend   = new LocalBackend(null, proxyController, slaveClient);

            proxyController.GetCurrentEntryAsync().Returns(
                new CommandEntry()
            {
                Name = "oldName"
            },
                new CommandEntry()
            {
                Name = "newName"
            });
            backend.CurrentChanged += (o, e) => wasCalled = true;
            await backend.SetCurrentAsync("newName").ConfigureAwait(false);

            Assert.That(wasCalled, Is.True);
        }