Inheritance: ResponseFields
Exemplo n.º 1
0
        /// <summary>
        /// Adds a response to the stub that will return the specified data.
        /// </summary>
        /// <param name="data">The data to be returned</param>
        /// <returns>The stub that the response was added to</returns>
        public TcpStub ReturnsData(string data)
        {
            var fields = new TcpResponseFields
            {
                Data = data
            };

            var response = new IsResponse<TcpResponseFields>(fields);

            return Returns(response);
        }
Exemplo n.º 2
0
        public void Returns_AddsResponse_SetsFields()
        {
            var expectedFields = new TcpResponseFields
            {
                Data = "TestData"
            };

            var stub = new TcpStub();
            stub.Returns(new IsResponse<TcpResponseFields>(expectedFields));

            var response = stub.Responses.First() as IsResponse<TcpResponseFields>;
            Assert.IsNotNull(response);
            Assert.AreEqual(expectedFields, response.Fields);
        }