public void MessageStateData_ShouldCreateConcurrentDictionaryByDefault() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var statefulMessage = new FakeStatefulMessage(); //---------------Test Result ----------------------- statefulMessage.MessageStateData.Should().NotBeNull(); statefulMessage.MessageStateData.Should().BeOfType <ConcurrentDictionary <string, object> >(); }
public void AddStateData_GivenValidData_ShouldAddToStateData() { //---------------Set up test pack------------------- var dataKey = "dataKey"; var stateData = new object(); var statefulMessage = new FakeStatefulMessage(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- statefulMessage.AddStateData(dataKey, stateData); //---------------Test Result ----------------------- statefulMessage.MessageStateData.Should().ContainKey(dataKey); statefulMessage.MessageStateData.Should().ContainValue(stateData); }
public void AddStateData_GivenValidDictionaryData_ShouldAddToStateData() { //---------------Set up test pack------------------- var stateData = new Dictionary <string, object> { { "dataKey1", new object() }, { "dataKey2", new object() } }; var statefulMessage = new FakeStatefulMessage(); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- statefulMessage.AddStateData(stateData); //---------------Test Result ----------------------- statefulMessage.MessageStateData.Count.Should().Be(stateData.Count); statefulMessage.MessageStateData.Should().ContainKey(stateData.Keys.ToArray()[0]); statefulMessage.MessageStateData.Should().ContainKey(stateData.Keys.ToArray()[1]); statefulMessage.MessageStateData.Should().ContainValue(stateData["dataKey1"]); statefulMessage.MessageStateData.Should().ContainValue(stateData["dataKey2"]); }