public void AreAllElementsInMessageContainedInContractShouldReturnValidContract() { var contractDictionary = new CaseInsensitiveDictionary <SchemaObject> { { "Name", new SchemaObject { Type = "String" } }, { "Age", new SchemaObject { Type = "Integer" } } }; var messageKeyDictionary = new CaseInsensitiveDictionary <object> { { "Name", "Robert" }, { "Age", "31" } }; var testService = new TesterService(); var result = testService.AreAllElementsInMessageContainedInContract(messageKeyDictionary, contractDictionary); result.IsMessageValid.ShouldBeTrue(); }
public void AreAllElementsInMessageContainedInContractShouldReturnInvalidContract() { var contractDictionary = new CaseInsensitiveDictionary <SchemaObject> { { "Name", new SchemaObject { Type = "String" } } }; var messageKeyDictionary = new CaseInsensitiveDictionary <object> { { "Name", "Robert" }, { "Age", "31" } }; var testService = new TesterService(); var result = testService.AreAllElementsInMessageContainedInContract(messageKeyDictionary, contractDictionary); result.IsMessageValid.ShouldBeFalse("Message property \"Age\" is not part of the contract."); }