Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to connect MySql via network Pin
Erdinc2723-Sep-10 1:46
Erdinc2723-Sep-10 1:46 
QuestionIcon for dll assembly Pin
Chesnokov Yuriy22-Sep-10 19:13
professionalChesnokov Yuriy22-Sep-10 19:13 
AnswerRe: Icon for dll assembly Pin
AspDotNetDev22-Sep-10 19:34
protectorAspDotNetDev22-Sep-10 19:34 
QuestionQuick C# Help Retrieve data using while (!sr.EndOfStream) Pin
d87c22-Sep-10 17:35
d87c22-Sep-10 17:35 
AnswerRe: Quick C# Help Retrieve data using while (!sr.EndOfStream) Pin
AspDotNetDev22-Sep-10 18:58
protectorAspDotNetDev22-Sep-10 18:58 
GeneralRe: Quick C# Help Retrieve data using while (!sr.EndOfStream) Pin
d87c22-Sep-10 19:05
d87c22-Sep-10 19:05 
GeneralRe: Quick C# Help Retrieve data using while (!sr.EndOfStream) Pin
AspDotNetDev22-Sep-10 19:17
protectorAspDotNetDev22-Sep-10 19:17 
QuestionRetrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 15:01
mtn*rain22-Sep-10 15:01 
I am new to C# and need to create a new class for NUnit that will enter and test items into an array. The first class is Item
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReneApp.Domain
{
    public class Item
    {
        public string Status;                   // Status of the item.
        public string Title;                    // Title of the item.
        public string Series;                   // Series of the item.
        public string Author;                   // Author of the item.
        public string Type;                     // Type of item.
        public string Description;              // Description of the item.   
        public bool Addition;                   // Addition of item.

        public string status
        {
            get { return Status; }
            set { Status = value; }
        }

        public string title
        {
            get { return Title; }
            set { Title = value; }
        }

        public string series
        {
            get { return Series; }
            set { Series = value; }
        }

        public string author
        {
            get { return Author; }
            set { Author = value; }
        }

        public string type
        {
            get { return Type; }
            set { Type = value; }
        }

        public string description
        {
            get { return Description; }
            set { Description = value; }
        }

        public bool addition
        {
            get { return Addition; }
            set { Addition = value; }
        }
    }

    // Declare type to process item.
    public delegate void ProcessItemDelegate(Item item);
}

The second class is Transaction
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReneApp.Domain
{
    public class Transaction
    {
        // List of all items in the database:
        private IList<Item> list = new List<Item>();

        // Add an item to the database:
        public void AddItem(Item item)
        {
            list.Add(item);
        }

        public bool ValidateTransaction()
        {
            if (list == null)
                return false;
            return true;
        }

        // Process items
        public void ProcessItem(ProcessItemDelegate processItem)
        {
            foreach (Item b in list)
            {
                if (b.addition)
                    processItem(b);
            }
        }
    }
}

The class that I am testing with is
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReneApp.Domain
{
    using NUnit.Framework;
    [TestFixture]

    public class TransactionTest
    {
        [Test]
        public void ValidateTransaction()
        {
            Transaction transaction1 = new Transaction("Stock", "Dark Rival", "Masters of Time", "Brenda Joyce", "Book", "Time Travel", true);
            Assert.IsTrue(transaction1.ValidateTransaction());
            Transaction transaction2 = new Transaction(" ", " ", " ", " ", " ", " ", " ");
            Assert.IsTrue(transaction2.ValidateTransaction());
        }


    }
}


I am unsure how to get the items in the array into the test. Any help would be appreciated. With the current, I am getting an error on the two ValidateTransaction items saying "ReneApp.Domain.Transaction does not contain a constructor that takes 7 arguments"
AnswerRe: Retrieve array items to use in NUnit Test Pin
Luc Pattyn22-Sep-10 15:37
sitebuilderLuc Pattyn22-Sep-10 15:37 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 15:39
mtn*rain22-Sep-10 15:39 
AnswerRe: Retrieve array items to use in NUnit Test Pin
Luc Pattyn22-Sep-10 15:44
sitebuilderLuc Pattyn22-Sep-10 15:44 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 15:48
mtn*rain22-Sep-10 15:48 
GeneralRe: Retrieve array items to use in NUnit Test Pin
Luc Pattyn22-Sep-10 15:59
sitebuilderLuc Pattyn22-Sep-10 15:59 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 16:02
mtn*rain22-Sep-10 16:02 
AnswerRe: Retrieve array items to use in NUnit Test Pin
AspDotNetDev22-Sep-10 16:07
protectorAspDotNetDev22-Sep-10 16:07 
GeneralRe: Retrieve array items to use in NUnit Test Pin
mtn*rain22-Sep-10 16:12
mtn*rain22-Sep-10 16:12 
GeneralRe: Retrieve array items to use in NUnit Test Pin
Paul Michalik22-Sep-10 20:47
Paul Michalik22-Sep-10 20:47 
Question3 way byte merge Pin
jkohler22-Sep-10 4:01
jkohler22-Sep-10 4:01 
AnswerRe: 3 way byte merge Pin
OriginalGriff22-Sep-10 4:19
mveOriginalGriff22-Sep-10 4:19 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 4:28
jkohler22-Sep-10 4:28 
AnswerRe: 3 way byte merge Pin
Ennis Ray Lynch, Jr.22-Sep-10 5:07
Ennis Ray Lynch, Jr.22-Sep-10 5:07 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 5:15
jkohler22-Sep-10 5:15 
GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 5:40
harold aptroot22-Sep-10 5:40 
GeneralRe: 3 way byte merge Pin
jkohler22-Sep-10 6:00
jkohler22-Sep-10 6:00 
GeneralRe: 3 way byte merge Pin
harold aptroot22-Sep-10 6:11
harold aptroot22-Sep-10 6:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.