コード例 #1
0
        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> >();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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"]);
        }