public void Create_WhenParametersNull_ExpectException() { // Arrange var target = new StringJsonRequestBuilder(); target.Build(null); // Assert }
public void Create_WhenParametersNotTypeOfStringParameter_ExpectException() { // Arrange Mock<IParameters> parameters = new Mock<IParameters>(); var target = new StringJsonRequestBuilder(); target.Build(parameters.Object); // Assert }
public void WhenParametersCorrect_ExpectJsonReturned() { // Arrange const int numberOfItems = 1; const int length = 10; const string charactersAllowed = "abc"; const bool allowDuplicates = false; JObject expected = new JObject( new JProperty(JsonRpcConstants.NUMBER_ITEMS_RETURNED_PARAMETER_NAME, numberOfItems), new JProperty(JsonRpcConstants.LENGTH_PARAMETER_NAME, length), new JProperty(JsonRpcConstants.CHARACTERS_ALLOWED_PARAMETER_NAME, charactersAllowed), new JProperty(JsonRpcConstants.REPLACEMENT_PARAMETER_NAME, allowDuplicates) ); // Act var parameters = StringParameters.Create(numberOfItems, length, charactersAllowed, allowDuplicates); var target = new StringJsonRequestBuilder(); var actual = target.Build(parameters); // Assert actual.Should().Equal(expected); }