I am using nopcommer 2.20 version. I have attached a new module for customer support. I have inserted data in the database. But when I try to implement the test the data from nop.data.test project I cannot test for my new entity(table). but the previous table/entity used in the project work fine. var fromDb = SaveAndLoadEntity(customerSupport);
the fromDb returns always null for my table/entiry. If anyone help me regarding this issue I will be grateful to you.
I am using nopcommer 2.20 version. I have attached a new module for customer support. I have inserted data in the database. But when I try to implement the test the data from nop.data.test project I cannot test for my new entity(table). but the previous table/entity used in the project work fine. var fromDb = SaveAndLoadEntity(customerSupport);
the fromDb returns always null for my table/entiry. If anyone help me regarding this issue I will be grateful to you.
Regards,
Asraful
Could you provide some more code so we can get more context around the problem? I believe the issues is that you're not using the correct database context class. You probably have a custom entity context and the tests are configured to use the nop context.
Thanks for your reply. Here is the code I am using using System; using System.Linq; using Nop.Core.Domain.Affiliates; using Nop.Core.Domain.Catalog; using Nop.Core.Domain.Common; using Nop.Core.Domain.Customers; using Nop.Core.Domain.Directory; using Nop.Core.Domain.Localization; using Nop.Core.Domain.Orders; using Nop.Core.Domain.Tax; using Nop.Tests; using NUnit.Framework;
namespace Nop.Data.Tests.Customers { [TestFixture] public class CustomerSupportPersistanceTest : PersistenceTest { [Test] public void Can_save_and_load_customersupport() { var customerSupport = GetTestCustomerSupport(); var fromDb = SaveAndLoadEntity(customerSupport);
Nop.Data.Tests.Customers.CustomerSupportPersistanceTest.Can_save_and_load_customersupport: Expected: not null But was: null
If you look at the code for PersistenceTest you'll see that it creates a new instance of NopObjectContext. Your test will not work. You need to create a different version of PersistanceTest that is specific to your new object context (I'm assuming you have a different object context, but you didn't provide the code in previous posts).
Can you please let me help regarding this issue? I have different business object. I have added a new table custoersupport in the database. So How I can made different version of persistance test.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Vous avez encore des questions ou avez besoin d'aide?