Beispiel #1
0
        private static bool RestoreXmlSerializedFavorite(Tuple <string, Type> testCase)
        {
            var           serializer = new FavoritesFileSerializer(TestConnectionManager.Instance);
            FavoritesFile file       = CreateTestFile(testCase.Item1);
            var           context    = new SerializationContext(file, new UnknonwPluginElements());

            serializer.Serialize(context, FILE_NAME);
            SerializationContext loaded = serializer.Deserialize(FILE_NAME);
            Favorite             target = loaded.File.Favorites[0];

            return(target.ProtocolProperties.GetType().FullName == testCase.Item2.FullName);
        }
Beispiel #2
0
        private static SerializationContext SerializeRdpVncDeserializeRdpOnly()
        {
            var           fullSerializer = new FavoritesFileSerializer(TestConnectionManager.Instance);
            FavoritesFile file           = CreateTestFile(RDP_FAVORITE, VNC_FAVORITE);
            var           context        = new SerializationContext(file, new UnknonwPluginElements());

            fullSerializer.Serialize(context, FILE_NAME);
            var rdpOnlyManager    = TestConnectionManager.CreateRdpOnlyManager();
            var limitedSerializer = new FavoritesFileSerializer(rdpOnlyManager);

            return(limitedSerializer.Deserialize(FILE_NAME));
        }
Beispiel #3
0
        private static string SerializeAndLoadSavedContent()
        {
            var           rdpOnlyManager  = TestConnectionManager.CreateRdpOnlyManager();
            FavoritesFile file            = CreateTestFile(KnownConnectionConstants.RDP);
            var           unknownElements = new UnknonwPluginElements();

            unknownElements.Favorites.Add(vncCachedFavorite);
            unknownElements.GroupMembership[GROUP_ID] = new List <XElement>()
            {
                UNKNOWN_VNC
            };
            var context           = new SerializationContext(file, unknownElements);
            var limitedSerializer = new FavoritesFileSerializer(rdpOnlyManager);

            limitedSerializer.Serialize(context, FILE_NAME);
            string saved = File.ReadAllText(FILE_NAME);

            return(saved);
        }