public void SubscribeReplyMustHaveMiningNotify() { var dummyReply = "[[[\"mining.set_difficulty\",\"deadbeefcafebabecffd010000000000\"]],\"0800c0ff\",4]"; var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply); Assert.Throws <MissingRequiredException>(() => ResponseParser.MiningSubscribe(uglee)); }
public void SubscribeReplyExtra2SzMustBe4() // ok really, I'm taking it easy for the time being. Even though bigger nonces might be useful in the future. { var bruh = "[[[\"mining.set_difficulty\",\"deadbeefcafebabecffd010000000000\"],[\"mining.notify\",\"deadbeefcafebabecffd010000000000\"]],\"0800c0ff\",8]"; var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(bruh); Assert.Throws <BadParseException>(() => ResponseParser.MiningSubscribe(uglee)); }
public void SubscribeReplyExtra2SzMustBePositive() { var bruh = "[[[\"mining.set_difficulty\",\"deadbeefcafebabecffd010000000000\"],[\"mining.notify\",\"deadbeefcafebabecffd010000000000\"]],\"0800c0ff\",-1]"; var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(bruh); Assert.Throws <BadParseException>(() => ResponseParser.MiningSubscribe(uglee)); }
public void SubscribeReplyExtranonceCanHaveDifferentLengths(string dummyReply, string sessionId, byte[] extraNonce1, int extraNonce2sz) { var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply); var response = ResponseParser.MiningSubscribe(uglee); Assert.Equal(sessionId, response.sessionId); Assert.Equal(extraNonce1, response.extraNonceOne); Assert.Equal(extraNonce2sz, response.extraNonceTwoByteCount); }
public void ParsingGoodSubscribeReply(string dummyReply, string sessionId, byte[] extraNonce1, int extraNonce2sz) { // That's how it comes out from the parsing. I don't like it at all but that's it. var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply); var response = ResponseParser.MiningSubscribe(uglee); Assert.Equal(sessionId, response.sessionId); Assert.Equal(extraNonce1, response.extraNonceOne); Assert.Equal(extraNonce2sz, response.extraNonceTwoByteCount); }
public void SubscribeReplyExtranonceMustBeNonempty(string dummyReply) { var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply); Assert.Throws <MissingRequiredException>(() => ResponseParser.MiningSubscribe(uglee)); }
public void SubscribeReplyExtranonceMustBeIntegralHex(string dummyReply) { var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply); Assert.Throws <BadParseException>(() => ResponseParser.MiningSubscribe(uglee)); }