1: 'The following code was generated by Microsoft Visual Studio 2005.
2: 'The test owner should check each test for validity.
3: Imports Microsoft.VisualStudio.TestTools.UnitTesting
4: Imports System
5: Imports System.Text
6: Imports System.Collections.Generic
7: Imports TCNorthwindClass
8: Imports TCNorthwindClass.TCNorthwindOffLoader
9:
10:
11: '''
12: '''This is a test class for TCNorthwindClass.TCNorthwindMethods and is intended
13: '''to contain all TCNorthwindClass.TCNorthwindMethods Unit Tests
14: '''
15: _
16: Public Class TCNorthwindMethodsTest
17:
18:
19: Private testContextInstance As TestContext
20: Private tcNorthWindMock As New TCNorthwindMock
21:
22: Public Property TestContext() As TestContext
23: Get
24: Return testContextInstance
25: End Get
26: Set(ByVal value As TestContext)
27: testContextInstance = value
28: End Set
29: End Property
30:
31: '''
32: '''A test for GetInventoryCountByCategory(ByVal Integer)
33: '''
34: _
35: Public Sub GetInventoryCountByCategoryTest()
36: Dim target As TCNorthwindMethods = New TCNorthwindMethods
37:
38: Dim categoryID As Integer = 3 'TODO: Initialize to an appropriate value
39:
40: Dim expected As Integer = 7
41: Dim actual As Integer
42:
43: actual = target.GetInventoryCountByCategory(categoryID, tcNorthWindMock)
44:
45: Assert.AreEqual(expected, actual, "TCNorthwindClass.TCNorthwindMethods.GetInventoryCountByCategory did not return th" & _
46: "e expected value.")
47: End Sub
48:
49:
50:
51: '''
52: '''A test for GetProductsByCategoryID(ByVal Integer, ByVal TCNorthwindClass.IProvider)
53: '''
54: _
55: Public Sub GetProductsByCategoryIDTest()
56: Dim target As TCNorthwindMethods = New TCNorthwindMethods
57:
58: Dim categoryID As Integer = 3 'TODO: Initialize to an appropriate value
59:
60:
61:
62: Dim expected As New Products
63: For i As Integer = 0 To categoryID
64: Dim tProduct As New Product
65: With tProduct
66: .ProductID = i
67: .ProductName = String.Format("Item{0}", i) 68: .QuantityPerUnit = i.ToString
69: .ReorderLevel = i
70: .Discontinued = False
71: End With
72: expected.product.Add(tProduct)
73: Next
74:
75:
76:
77: Dim actual As Products
78:
79: actual = target.GetProductsByCategoryID(categoryID, tcNorthWindMock)
80:
81: Assert.AreEqual(expected.product.Count, actual.product.Count, "TCNorthwindClass.TCNorthwindMethods.GetProductsByCategoryID did not return the ex" & _
82: "pected value.")
83:
84:
85:
86: End Sub
87: End Class