Exemple #1
0
        public void Should_Receive_ClientAppMessage_When_ClientApp(ClientAppMessageType clientAppMessageType)
        {
            // Arrange
            var productId      = "MyProductId";
            var productVersion = "1.0.0.0";

            var eventRaised = new ManualResetEvent(false);

            _adminClient.ClientApp += message =>
            {
                if (message.Type == clientAppMessageType)
                {
                    eventRaised.Set();
                }
            };

            // Act
            if (clientAppMessageType == ClientAppMessageType.Register)
            {
                _adminClient.RegisterClientApp(productId, productVersion);
            }

            if (clientAppMessageType == ClientAppMessageType.Remove)
            {
                _adminClient.RemoveClientApp(productId, productVersion);
            }

            // Assert
            Assert.IsTrue(eventRaised.WaitOne());
        }