Example #1
0
 public void Save(PandaSocialNetwork network)
 {
     using (FileStream s = new FileStream(FILE_NAME_PATTERN, FileMode.Create))
     {
         formatter.Serialize(s, network);
     }
 }
Example #2
0
 public void Save(PandaSocialNetwork network)
 {
     using (FileStream s = new FileStream(FILE_NAME_PATTERN, FileMode.Create))
     {
         formatter.Serialize(s, network);
     }
 }
Example #3
0
        public void Save(PandaSocialNetwork network)
        {
            string serializedNetwork = JsonConvert.SerializeObject(network.ConvertToDTO());

            using (var sw = File.CreateText(FILE_NAME_PATTERN))
            {
                sw.Write(serializedNetwork);
            }

        }
		public void AddPandaTest()
		{
			PandaSocialNetwork b = new PandaSocialNetwork();
				//Panda, List<Panda>>();<Panda, List<Panda>> testcontainer = new Dictionary<Panda, List<Panda>>();
			Panda a = new Panda("Gosho", "*****@*****.**", GenderType.Male);


			b.AddPanda(a);

			Assert.IsTrue((b.HasPanda(a)));
		}
Example #5
0
        static void Main(string[] args)
        {
            Panda panda1 = new Panda("Pesho", "*****@*****.**", GenderType.Male);
            Panda panda2 = new Panda("Mariika", "*****@*****.**", GenderType.Female);
            Panda panda3 = new Panda("Stoyanka", "*****@*****.**", GenderType.Female);
            Panda panda4 = new Panda("Ivancho", "*****@*****.**", GenderType.Male);
            PandaSocialNetwork a = new PandaSocialNetwork();
            a.MakeFriends(panda1, panda2);
            a.MakeFriends(panda1, panda3);
            a.MakeFriends(panda2, panda3);
            a.MakeFriends(panda3, panda4);
            Console.WriteLine(a.HowManyGenderInNetwork(2, panda1, GenderType.Male));

            JSONPandaSerializer serializer = new JSONPandaSerializer();
            serializer.Save(a);
            PandaSocialNetwork deserializedNetwork = serializer.Load();

            //BinaryPandaSerializer binSerializer = new BinaryPandaSerializer();
            //binSerializer.Save(a);
            //PandaSocialNetwork temp = binSerializer.Load();

        }
Example #6
0
 static void Main(string[] args)
 {
     PandaSocialNetwork a = new PandaSocialNetwork();
 }