method used like a type error in a unit test
Posted
by
Josepth Vodary
on Stack Overflow
See other posts from Stack Overflow
or by Josepth Vodary
Published on 2012-09-24T15:33:00Z
Indexed on
2012/09/24
15:37 UTC
Read the original article
Hit count: 225
I am trying to unit test a simple factory - but it keeps telling me that I am trying to use a method like a type?
My unit test
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Home;
namespace HomeTest
{
[TestClass]
public class TestFactory
{
[TestMethod]
public void DoTestFactory()
{
InventoryType.InventorySelect select = new InventoryType.InventorySelect();
select.inventoryTypes.Add("cds");
Home.Services.Factory.CreateInventory get = new Home.Services.Factory.CreateInventory();
get.InventoryImpl();
if (select.Validate() == true)
Console.WriteLine("Test Passed");
else
if (select.Validate() == false)
Console.WriteLine("Test Returned False");
else
Console.WriteLine("Test Failed To Run");
Console.ReadLine();
}
}
}
My facotry
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Home.Services
{
public class Factory
{
public InventorySvc CreateInventory()
{
return new InventoryImpl();
}
}
}
© Stack Overflow or respective owner