public async void ShouldSendGetDeviceDescriptionRequest(int deviceId)
        {
            var communicatorMock    = new Mock <ICommunicator>();
            var eventAggregatorMock = new Mock <IEventAggregator>();
            var viewModel           = new DeviceDetailPageModel(communicatorMock.Object, eventAggregatorMock.Object);
            await viewModel.LoadedAsync(deviceId);

            communicatorMock.Verify(x => x.SendAsync(It.Is <IRequest>(request => request is GetDeviceDescriptionDataRequest && ((GetDeviceDescriptionDataRequest)request).Identifier == deviceId)));
        }
        public async void ShouldSetDevice()
        {
            const int deviceId            = 5;
            var       communicatorMock    = new Mock <ICommunicator>();
            var       eventAggregatorMock = new Mock <IEventAggregator>();
            var       viewModel           = new DeviceDetailPageModel(communicatorMock.Object, eventAggregatorMock.Object);
            await viewModel.LoadedAsync(deviceId);

            communicatorMock.Raise(x => x.ReceiveData += null, new GetDeviceDescriptionDataResponse {
                Identifier = deviceId, Description = "my device description"
            });

            viewModel.Device.Id.Should().Be(deviceId);
            viewModel.Device.Description.Should().Be("my device description");
        }
        public async void ShouldDeleteDevice()
        {
            const int deviceId            = 5;
            var       communicatorMock    = new Mock <ICommunicator>();
            var       eventAggregatorMock = new Mock <IEventAggregator>();
            var       viewModel           = new DeviceDetailPageModel(communicatorMock.Object, eventAggregatorMock.Object);
            await viewModel.LoadedAsync(deviceId);

            communicatorMock.Raise(x => x.ReceiveData += null, new GetDeviceDescriptionDataResponse {
                Identifier = deviceId, Description = "my device description"
            });

            await viewModel.DeleteDeviceCommand.Execute(null);

            communicatorMock.Verify(x => x.SendAsync(It.Is <IRequest>(request => request is DeleteDeviceDataRequest &&
                                                                      ((DeleteDeviceDataRequest)request).Identifier == deviceId)));
        }
        public async void ShouldNavigateToDeviceOverviewIfDeviceWasDeleted()
        {
            const int deviceId            = 5;
            var       communicatorMock    = new Mock <ICommunicator>();
            var       eventAggregatorMock = new Mock <IEventAggregator>();
            var       viewModel           = new DeviceDetailPageModel(communicatorMock.Object, eventAggregatorMock.Object);
            await viewModel.LoadedAsync(deviceId);

            communicatorMock.Raise(x => x.ReceiveData += null, new GetDeviceDescriptionDataResponse {
                Identifier = deviceId, Description = "my device description"
            });

            communicatorMock.Raise(x => x.ReceiveData += null, new DeleteDeviceDataResponse {
                Identifier = deviceId
            });

            eventAggregatorMock.Verify(x => x.PublishAsync(It.Is <NavigationEvent>(y => y.ViewType == typeof(DeviceOverviewPage))));
        }