public void Handle_WhenIdIsNotEqualToParameterId_ShouldReturnFalse() { // Arrange const int expected = 12345; const int id = 64321; Mock<IParameters> parametersMock = new Mock<IParameters>(); parametersMock.Setup(p => p.Id).Returns(expected); var input = new JObject( new JProperty("jsonrpc", "2.0"), new JProperty("id", id) ); // Act VerifyIdResponseHandler target = new VerifyIdResponseHandler(); target.Handle(parametersMock.Object, input.ToString()); // Assert }
public void Handle_WhenIdIsFoundInJson_ShouldBeZero() { // Arrange int expected = RandomGenerator.GetInteger(1); Mock<IParameters> parametersMock = new Mock<IParameters>(); parametersMock.Setup(p => p.Id).Returns(expected); var input = new JObject( new JProperty("jsonrpc", "2.0"), new JProperty("id", expected) ); // Act VerifyIdResponseHandler target = new VerifyIdResponseHandler(); bool actual = target.Handle(parametersMock.Object, input.ToString()); // Assert actual.Should().Be.True(); // If returns true then Id is zero }
public void CanHandle_WhenCalled_ShouldReturnTrue() { // Arrange // Act VerifyIdResponseHandler target = new VerifyIdResponseHandler(); var actual = target.CanHandle(null); // Assert actual.Should().Be.True(); }