Exemple #1
0
        private static LogicAppNotUpdatedException SerializeDeserializeException(LogicAppNotUpdatedException exception)
        {
            var formatter = new BinaryFormatter();

            using (var contents = new MemoryStream())
            {
                formatter.Serialize(contents, exception);
                contents.Seek(0, 0);

                var deserialized = (LogicAppNotUpdatedException)formatter.Deserialize(contents);
                return(deserialized);
            }
        }
Exemple #2
0
        public void SerializeException_WithoutProperties_SerializesWithoutProperties()
        {
            // Arrange
            var innerException = new InvalidOperationException("Problem with update");
            var exception      = new LogicAppNotUpdatedException("App not updated", innerException);

            var expected = exception.ToString();

            // Act
            LogicAppNotUpdatedException actual = SerializeDeserializeException(exception);

            // Assert
            Assert.Equal(expected, actual.ToString());
        }
Exemple #3
0
        public void CreateException_WithAllProperties_AssignsAllProperties()
        {
            // Arrange
            string logicApp = "logic app name", resourceGroup = "resource group", subscriptionId = "subscription ID";
            string message        = "There's something wrong with updating the logic app";
            var    innerException = new KeyNotFoundException("Couldn't find the logic app");

            // Act
            var exception = new LogicAppNotUpdatedException(subscriptionId, resourceGroup, logicApp, message, innerException);

            // Assert
            Assert.Equal(message, exception.Message);
            Assert.Equal(logicApp, exception.LogicAppName);
            Assert.Equal(resourceGroup, exception.ResourceGroup);
            Assert.Equal(subscriptionId, exception.SubscriptionId);
            Assert.Equal(innerException, exception.InnerException);
        }
Exemple #4
0
        public void SerializeException_WithProperties_SerializeWithProperties()
        {
            // Arrange
            string logicApp       = "logic app name",
                   resourceGroup  = "resouce group",
                   subscriptionId = "subscription ID";

            var innerException = new KeyNotFoundException("Problem with update");
            var exception      = new LogicAppNotUpdatedException(subscriptionId, resourceGroup, logicApp, "App not updated", innerException);

            string expected = exception.ToString();

            // Act
            LogicAppNotUpdatedException actual = SerializeDeserializeException(exception);

            // Assert
            Assert.Equal(expected, actual.ToString());
            Assert.Equal(logicApp, actual.LogicAppName);
            Assert.Equal(resourceGroup, actual.ResourceGroup);
            Assert.Equal(subscriptionId, actual.SubscriptionId);
        }