Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42321

VS 2010 Adding references to custom structures for testing

$
0
0
I have a VS2012 Visual Basic.NET application and am wanting to create some unit tests for this application.

Here is the module code:

Code:

Imports System.IO

Namespace modCanMediaStructures

Module modCanMediaStructures

    <Serializable()> Public Structure MediaItem
        Dim longMediaID As Long
        Dim MediaObject As WMPLib.IWMPMedia
        Dim FileInfoObject As FileInfo
        Dim stringGenre As String
        Dim stringMediaDuration As String
        Dim doubleMediaLength As Double
    End Structure

    <Serializable()> Public Structure MediaPlayList
        Dim stringMediaPlayListName As String
        Dim stringMediaPlayListDescription As String
        Dim stringMediaPlayListComments As String
        Dim mediaItemList As List(Of MediaItem)
        Dim stringPlayListDuration As String
        Dim doublePlayListDuration As Double
        Dim booleanShuffle As Boolean
        Dim booleanLoop As Boolean
    End Structure

    Public Structure genreItem
        Dim stringGenreName As String
        Dim longGenreCount As Long
        Dim doubleGenreDuration As Double
    End Structure

    <Serializable()> Public Structure ScheduleItem
        Dim stringItemName As String
        Dim stringItemPlaylist As String
        Dim stringItemDuration As String
        Dim stringItemComments As String
        Dim doubleItemDuration As Double
        Dim booleanStartDateIsDerivedFromEndOfOtherScheduleItem As Boolean
        Dim stringScheduleItemThatStartDateIsDerivedFrom As String
        Dim dateItemStartDateTime As Date
        Dim dateItemEndDateTime As Date
        Dim booleanEndDateIsDerivedFromPlayListDuration As Boolean
    End Structure

End Module

End Namespace

In my main form, I declare a variable as follows:

Code:

Dim testMediaItem As modCanMediaStructures.MediaItem
After importing the following statement:

Code:

Imports modCanMediaStructures
This works. However, when I do the same statement in the UnitTest test, the following error occurs:

Quote:

Type 'modCanMediaStructures.MediaItem' is not defined
Here is my code:

Code:

Imports System.Text
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports CanMediaPlayer
Imports modCanMediaStructures

<TestClass()> Public Class MediaListTests

<TestMethod()> Public Sub TestaddMediaItemToList()

    Dim myStructure As New modCanMediaStructures.MediaItem

End Sub

End Class

I believe that this is happeneing because the UnitTest Project cannot actually 'see' the code in the other solution files.

May I please have some help to get this working?

Viewing all articles
Browse latest Browse all 42321


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>