Inheritance: StubBase
Example #1
0
        public void ReturnsData_AddsResponse_DataSet()
        {
            const string expectedData = "TestData";

            var stub = new TcpStub();
            stub.ReturnsData(expectedData);

            var response = stub.Responses.First() as IsResponse<TcpResponseFields>;
            Assert.IsNotNull(response);
            Assert.AreEqual(expectedData, response.Fields.Data);
        }
Example #2
0
        public void OnDataEquals_AddsPredicate_DataSet()
        {
            const string expectedData = "TestData";

            var stub = new TcpStub();
            stub.OnDataEquals(expectedData);

            var predicate = stub.Predicates.First() as EqualsPredicate<TcpPredicateFields>;
            Assert.IsNotNull(predicate);
            Assert.AreEqual(expectedData, predicate.Fields.Data);
        }
Example #3
0
        public void On_AddsPredicate_SetsFields()
        {
            var expectedFields = new TcpPredicateFields
            {
                Data = "TestData",
                RequestFrom = "socket"
            };

            var stub = new TcpStub();
            stub.On(new EqualsPredicate<TcpPredicateFields>(expectedFields));

            var predicate = stub.Predicates.First() as EqualsPredicate<TcpPredicateFields>;
            Assert.IsNotNull(predicate);
            Assert.AreEqual(expectedFields, predicate.Fields);
        }
Example #4
0
 public TcpStub AddStub()
 {
     var stub = new TcpStub();
     Stubs.Add(stub);
     return stub;
 }
Example #5
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);
        }
Example #6
0
 public void Constructor_InitializesResponsesCollection()
 {
     var stub = new TcpStub();
     Assert.IsNotNull(stub.Responses);
 }
Example #7
0
 public void Constructor_InitializesPredicatesCollection()
 {
     var stub = new TcpStub();
     Assert.IsNotNull(stub.Predicates);
 }