Link to home
Start Free TrialLog in
Avatar of nkoriginal
nkoriginalFlag for Spain

asked on

Error trying to run Unit Test or process

I tried to check my code using unified test. I dont know if that's the name for this process. In spanish is "Pruebas Unitarias" but I dont get the correct translation.
Im using nunit to check my code.
The error I've is:

Cannot implicitly convert type 'Esabe.Grazalema.Business.Appliances.IDS' to 'string'

Check My code pls.

Thanks for any help
// This is the code in my "Unified test" and the error is in the string id....... line
    
[Test]
    public void InsertNew2()
    {
        Appliances am = new Appliances();
        string id = am.Insert2("BP-BCNSAV", 5131, "0006B12D2D98", true, "severN_prueba");
        Assert.AreNotEqual(0, id, "El id de la alerta insertada no es válido");
    }
 
//I invoke this method:
 
public IDS Insert2(string name, int companyId, string serialNumber, bool applianceCRM, string severName)
 
{
    // Some functions
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nkoriginal

ASKER

I tried to change to IDS id, but I cannot found the IDS method.
I've a separate page to check the code, so when I called the IDS, it said: The type or namespace name IDS could not be found( are you missing a using directive or an assembly reference)

i clean my solution and I rebuild it.
If this is a part of the same project as the original code for IDS, then as long as you declared it "public," you should be able to access it from here. If it is a different project, then it may be just as easy to copy the definition of IDS to this project. Just paste the struct definition outside of this class, but within the namespace and you should be fine.
namespace SomeNamespace
{
    public class InitialClass
    {
        // some stuff
    }
 
    // Paste here
    public struct IDS
    {
        public int appID;
        public int coID;
    }
}

Open in new window

I dont know how to say THANK YOU. You help me a lot with a project at my work.
I really appreciate your help.

I need one more help, with the code you send me, is something about the exception (I promise is my last question). i will open the question, if you could help me I will really appreciate it, if not, thanks any way.
Amazing Help. thank u very much!! :D:D
Kaufmed, here is the link if you can help me with the exception I need in my code. Is inside the code you gave me in other question i made.

https://www.experts-exchange.com/questions/24436663/throw-new-exception-but-continue-with-the-next-statment.html

thanks again!
:)