Hi,
I want to make some tests in my project.
I'm using default "test" provided with Visual Studio TS 2008.
I wrote some code:
[TestInitialize()]
public void InitializeData()
{
new SchemaExport(NHibernateHelper.Configuration).Execute(false, true,
false);
using (ISession session = NHibernateHelper.OpenSession())
using (ITransaction trans = session.BeginTransaction())
{
Category cat1 = new Category() { Name = "Komputery", ParentId =
0 };
session.Save(cat1);
session.Save(new Category() { Name = "Stacjonarne", ParentId =
cat1.Id });
Category cat3 = new Category() { Name = "Laptopy", ParentId =
cat1.Id };
session.Save(cat3);
session.Save(new Category() { Name = "Laptopy Asus", ParentId =
cat3.Id });
Tax tax = new Tax();
tax.Name = "22%";
tax.Value = 22;
tax.ReceiptName = "A";
session.Save(tax);
session.Save(new Product() { Name = "Leenovo 1234", Category =
cat1,
SellPrice = 1111, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "Asus 1234", Category =
cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "IBM 1234", Category = cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "Komputronik 1234",
Category =
cat1, SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "Toshiba 1234", Category =
cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "Samsung 1234", Category =
cat1,
SellPrice = 1, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "MSI 1234", Category = cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "DELL 1234", Category =
cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "Actina 1234", Category =
cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Product() { Name = "Tyan 1234", Category =
cat1,
SellPrice = 120, LastPurchasePrice = 115, SellPriceType =
SellPriceType.Brutto, Tax = tax });
session.Save(new Warehouse() { Name = "Główny" });
session.Save(new Warehouse() { Name = "Komisowy" });
Country cou1 = new Country() { Name = "Polska", IsoCode = "PL"
};
session.Save(cou1);
session.Save(new Client() { Name = "Jan Kowalski", Street =
"Błotna", FlatNumber = "zachlapany", City = "Brudów", Country = cou1,
Email = "[email protected]", ZipCode = "00-000", Phone = "brak" });
trans.Commit();
}
}
[TestMethod()]
public void GetByNameTest()
{
ProductRepository target = new ProductRepository(); // TODO:
Initialize to an appropriate value
IList<Product> expected = target.GetByName("Samsung 1234");
Assert.AreEqual(expected[0].SellPrice, 1);
}
When test start its failed, exception tells me that he cant find
NHibernate dll's. How to configure it ?
__________________
Marcin Sowa, Poland
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.