public void TestMethodReceivePrivateMessage() { ASCIIEncoding encoding = new ASCIIEncoding(); DSACryptoServiceProvider mycryptoC = new DSACryptoServiceProvider(); DSAParameters publickeyC = mycryptoC.ExportParameters(false); DSACryptoServiceProvider mycryptoW = new DSACryptoServiceProvider(); DSAParameters publickeyW = mycryptoW.ExportParameters(false); byte[] hashC = mycryptoC.SignData(encoding.GetBytes("Cuddy")); byte[] hashW = mycryptoW.SignData(encoding.GetBytes("Wilson")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); a.Register("Cuddy", "iluvhouse", hashC, publickeyC.Counter, publickeyC.G, publickeyC.J, publickeyC.P, publickeyC.Q, publickeyC.Seed, publickeyC.X, publickeyC.Y); a.Register("Wilson", "ihatehouse", hashW, publickeyW.Counter, publickeyW.G, publickeyW.J, publickeyW.P, publickeyW.Q, publickeyW.Seed, publickeyW.X, publickeyW.Y); string message = "je suis jalouse de Cameron"; byte[] messagesigned = mycryptoC.SignData(encoding.GetBytes(message)); a.SendPrivateMessage("Cuddy", "Wilson", message, messagesigned); UnitTest.ServiceReference1.Message[] b = a.ReceivePrivateMessage("Wilson", hashW); Assert.AreEqual("Cuddy", b[0].Auteur); //j'avoue les test sont moisi... mais je voulais juste verifier si le retour par une classe implemente dans le webservice etait possible Assert.AreEqual("je suis jalouse de Cameron", b[0].Text); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodSendPrivateMessage() { ASCIIEncoding encoding = new ASCIIEncoding(); DSACryptoServiceProvider mycryptoC = new DSACryptoServiceProvider(); DSAParameters publickeyC = mycryptoC.ExportParameters(false); DSACryptoServiceProvider mycryptoW = new DSACryptoServiceProvider(); DSAParameters publickeyW = mycryptoW.ExportParameters(false); byte[] hashC = mycryptoC.SignData(encoding.GetBytes("Cuddy")); byte[] hashW = mycryptoW.SignData(encoding.GetBytes("Wilson")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); a.Register("Cuddy", "iluvhouse", hashC, publickeyC.Counter, publickeyC.G, publickeyC.J, publickeyC.P, publickeyC.Q, publickeyC.Seed, publickeyC.X, publickeyC.Y); a.Register("Wilson", "ihatehouse", hashW, publickeyW.Counter, publickeyW.G, publickeyW.J, publickeyW.P, publickeyW.Q, publickeyW.Seed, publickeyW.X, publickeyW.Y); string message = "je suis jalouse de Cameron"; byte[] messagesigned = mycryptoC.SignData(encoding.GetBytes(message)); Assert.AreEqual(true, a.SendPrivateMessage("Cuddy", "Wilson", message, messagesigned)); Assert.AreEqual(false, a.SendPrivateMessage("Cuddy", "Foreman", message, messagesigned)); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodSendPrivateMessage() { ASCIIEncoding encoding = new ASCIIEncoding(); DSACryptoServiceProvider mycryptoC = new DSACryptoServiceProvider(); DSAParameters publickeyC = mycryptoC.ExportParameters(false); DSACryptoServiceProvider mycryptoW = new DSACryptoServiceProvider(); DSAParameters publickeyW = mycryptoW.ExportParameters(false); byte[] hashC = mycryptoC.SignData(encoding.GetBytes("Cuddy")); byte[] hashW = mycryptoW.SignData(encoding.GetBytes("Wilson")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); a.Register("Cuddy", "iluvhouse", hashC, publickeyC.Counter, publickeyC.G, publickeyC.J, publickeyC.P, publickeyC.Q, publickeyC.Seed, publickeyC.X, publickeyC.Y); a.Register("Wilson", "ihatehouse", hashW, publickeyW.Counter, publickeyW.G, publickeyW.J, publickeyW.P, publickeyW.Q, publickeyW.Seed, publickeyW.X, publickeyW.Y); string message = "je suis jalouse de Cameron"; byte[] messagesigned = mycryptoC.SignData(encoding.GetBytes(message)); Assert.AreEqual(true,a.SendPrivateMessage("Cuddy", "Wilson", message, messagesigned)); Assert.AreEqual(false, a.SendPrivateMessage("Cuddy", "Foreman", message, messagesigned)); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodReceiveMessageUnread() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters publickey = mycrypto.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); string message = "je suis jalouse de Cameron"; byte[] messagesigned = mycrypto.SignData(encoding.GetBytes(message)); a.Register("Cuddy", "iluvhouse", hash, publickey.Counter, publickey.G, publickey.J, publickey.P, publickey.Q, publickey.Seed, publickey.X, publickey.Y); a.SendMessage("Cuddy", message, messagesigned); UnitTest.ServiceReference1.Message[] b = a.ReceiveMessageNonRead("Cuddy", hash); Assert.AreEqual("je suis jalouse de Cameron", b[0].Text); //meme commentaire que pour les messages prives Assert.AreEqual("Cuddy", b[0].Auteur); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodSendMessage() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters publickey = mycrypto.ExportParameters(false); DSACryptoServiceProvider petitmalin = new DSACryptoServiceProvider(); DSAParameters Clemoisi = petitmalin.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); string message = "je suis jalouse de Cameron"; a.Register("Cuddy", "iluvhouse", hash, publickey.Counter, publickey.G, publickey.J, publickey.P, publickey.Q, publickey.Seed, publickey.X, publickey.Y); byte[] messagesigned = mycrypto.SignData(encoding.GetBytes(message)); Assert.AreEqual(true, a.SendMessage("Cuddy", message, messagesigned)); byte[] hashmoisi = petitmalin.SignData(encoding.GetBytes(message)); Assert.AreEqual(false, a.SendMessage("Cuddy", message, hashmoisi)); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodRegisterAndLogin() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters Publickey = mycrypto.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); Assert.AreEqual(true, a.Register("Cuddy", "passbidon",hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); Assert.AreEqual(false, a.Register("Cuddy", "rate",hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); Assert.AreEqual(true,a.LogIn("Cuddy", "passbidon",hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); Assert.AreEqual(false, a.LogIn("Cuddy", "badpass",hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); //remise a zero du serveur File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodRegisterAndLogin() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters Publickey = mycrypto.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); Assert.AreEqual(true, a.Register("Cuddy", "passbidon", hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); Assert.AreEqual(false, a.Register("Cuddy", "rate", hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); Assert.AreEqual(true, a.LogIn("Cuddy", "passbidon", hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); Assert.AreEqual(false, a.LogIn("Cuddy", "badpass", hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); //remise a zero du serveur File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodCHangeNick() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters Publickey = mycrypto.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); a.Register("Cuddy", "passbidon", hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y); Assert.AreEqual(true, a.ChangeNick("Cuddy", "MissC", mycrypto.SignData(encoding.GetBytes("MissC")))); hash = mycrypto.SignData(encoding.GetBytes("MissC")); Assert.AreEqual(true, a.LogIn("MissC", "passbidon", hash, Publickey.Counter, Publickey.G, Publickey.J, Publickey.P, Publickey.Q, Publickey.Seed, Publickey.X, Publickey.Y)); }
public void TestMethodReceiveAllMessage() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters publickey = mycrypto.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); string message = "je suis jalouse de Cameron"; byte[] messagesigned = mycrypto.SignData(encoding.GetBytes(message)); a.Register("Cuddy", "iluvhouse", hash, publickey.Counter, publickey.G, publickey.J, publickey.P, publickey.Q, publickey.Seed, publickey.X, publickey.Y); a.SendMessage("Cuddy", message, messagesigned); UnitTest.ServiceReference1.Message[] b = a.ReceiveMessageNonRead("Cuddy", hash); UnitTest.ServiceReference1.Message[] c = a.ReceiveAllMessage("Cuddy", hash); Assert.AreEqual("je suis jalouse de Cameron", c[0].Text); //identique a tous les reception de message[] Assert.AreEqual("Cuddy", c[0].Auteur); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }
public void TestMethodSendMessage() { DSACryptoServiceProvider mycrypto = new DSACryptoServiceProvider(); DSAParameters publickey = mycrypto.ExportParameters(false); DSACryptoServiceProvider petitmalin = new DSACryptoServiceProvider(); DSAParameters Clemoisi = petitmalin.ExportParameters(false); ASCIIEncoding encoding = new ASCIIEncoding(); ServiceReference1.ServeurChatSoapClient a = new ServiceReference1.ServeurChatSoapClient(); byte[] hash = mycrypto.SignData(encoding.GetBytes("Cuddy")); string message = "je suis jalouse de Cameron"; a.Register("Cuddy", "iluvhouse", hash, publickey.Counter, publickey.G, publickey.J, publickey.P, publickey.Q, publickey.Seed, publickey.X, publickey.Y); byte[] messagesigned = mycrypto.SignData(encoding.GetBytes(message)); Assert.AreEqual(true, a.SendMessage("Cuddy", message, messagesigned)); byte[] hashmoisi = petitmalin.SignData(encoding.GetBytes(message)); Assert.AreEqual(false, a.SendMessage("Cuddy",message,hashmoisi)); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\Message_serialization.xml"); File.Delete("C:\\Program Files\\Common Files\\microsoft shared\\DevServer\\10.0\\User_serialization.xml"); }