Example #1
0
        public void TestUsingMock()
        {
            //Mockinf
            IPolicyQuote mockObj = GetMockForPolicyQuote();

            var componentUnderTest = new PolicyAnalyzer(mockObj);

            // Act:
            int company1Value = componentUnderTest.GetPolicyQuote("Vehicle1");
            int company2Value = componentUnderTest.GetPolicyQuote("Vehicle2");

            // Assert:
            Assert.AreEqual(500, company1Value);
            Assert.AreEqual(300, company2Value);
        }
Example #2
0
        public void TestUsingStub()
        {
            // Arrange:

            // Create the stockFeed stub
            IPolicyQuote stubObj = new PolicyAnalyis.StubPolicyAnalyzer();

            // In the completed application, stockFeed would be a real one:
            // Now, we are using the stubbed class
            var componentUnderTest = new PolicyAnalyzer(stubObj);

            // Act:
            int company1Value = componentUnderTest.GetPolicyQuote("Vehicle1");
            int company2Value = componentUnderTest.GetPolicyQuote("Vehicle2");

            // Assert:
            Assert.AreEqual(500, company1Value);
            Assert.AreEqual(300, company2Value);
        }