public void NetworkSerializeAndDeserialize() { var savedNetwork = new PandaSocialNetwork(); var ivo = new Panda("Ivo", "*****@*****.**", GenderType.Male); var rado = new Panda("Rado", "*****@*****.**", GenderType.Male); var tony = new Panda("Tony", "*****@*****.**", GenderType.Female); savedNetwork.AddPanda(ivo); savedNetwork.AddPanda(rado); savedNetwork.AddPanda(tony); savedNetwork.MakeFriends(ivo, rado); savedNetwork.MakeFriends(rado, tony); var pandaSerializer = new PandaSocialNetworkBinarySerializer("unitTest.dat"); pandaSerializer.Save(savedNetwork); var loadedNetwork = pandaSerializer.Load(); Assert.IsTrue( savedNetwork.HasPanda(ivo) == loadedNetwork.HasPanda(ivo) && savedNetwork.HasPanda(rado) == loadedNetwork.HasPanda(rado) && savedNetwork.HasPanda(tony) == loadedNetwork.HasPanda(tony) && savedNetwork.HasPanda(new Panda("a", "*****@*****.**", GenderType.Male)) == loadedNetwork.HasPanda(new Panda("a", "*****@*****.**", GenderType.Male)) && savedNetwork.ConnectionLevel(ivo, rado) == loadedNetwork.ConnectionLevel(ivo, rado) && savedNetwork.ConnectionLevel(ivo, tony) == loadedNetwork.ConnectionLevel(ivo, tony) && savedNetwork.HowManyGenderInNetwork(2, ivo, GenderType.Female) == loadedNetwork.HowManyGenderInNetwork(2, ivo, GenderType.Female) ); }
public void IfAlreadyFriends() { var alreadyFriends = new PandaSocialNetwork(); var panda1 = new Panda("Orhan", "*****@*****.**", GenderType.Male); var panda2 = new Panda("Mumun", "*****@*****.**", GenderType.Male); alreadyFriends.MakeFriends(panda1, panda2); alreadyFriends.MakeFriends(panda1, panda2); }