Click here to Skip to main content
15,891,006 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to unit test a method which return type is response result.i m facing problem which assert.areequal() method i will use for which my unit test will be succeded.
Posted

1 solution

Please give details of your question. I will better if you give your code. I guess you are facing problem in Assert.areequal(). Are you checking the object or value. If you check your object then you will not get your expected value.
Please provide your code. Thanks.
 
Share this answer
 
Comments
amritbdk 3-Mar-14 4:30am    
Hi Pls find my code bellow.I hve used several assert method pls guide me which one i will use


[TestMethod]
public void SaveUpdateAboutTest()
{
AboutConcept concept = new AboutConcept();
ResponseMessage currentresult;
int expected = 0;
int actual;
using (ShimsContext.Create())
{

concept.BrandId = 1;
concept.ConceptId = 1;
concept.ConceptHow.ConceptId = 1;
concept.ConceptHow.Formula = "nice";
concept.ConceptHow.Manufaturing = "nice";
concept.ConceptHow.Package = "good";
concept.ConceptHow.PromotionalElementsValue = "2";
concept.ConceptHow.SecondaryPackagingValue = "1";
// ShimDateTime.NowGet = () => new DateTime(2012, 12, 31);
concept.ConceptInfo.ConceptCreateDate = DateTime.Now;
concept.ConceptInfo.ConceptId = 1;
concept.ConceptInfo.ConceptInitiator = "gg";
concept.ConceptInfo.InnovationType = "gd";
concept.ConceptInfo.PrivacyLevel = "strng";
concept.ConceptInfo.ProductLaunchStream = "vv";
concept.ConceptInfo.TechnologyPlatform = ".net";
concept.ConceptWhat.BenefitBasedPlatformId = 1;
concept.ConceptWhat.ConceptDescription = "gd";
concept.ConceptWhat.ConceptId = 1;
concept.ConceptWhat.ConceptName = "ap";
var obj = new List<decimal>();

concept.ConceptWhat.CorporateInnovationPlatFromIds = obj;
var obj22 = new Nullable<decimal>();
concept.ConceptWhat.Form = obj22;

concept.ConceptWhat.Holiday = 5;
concept.ConceptWhat.HolidayName = "sun";
concept.ConceptWhat.MbcId = 3;
concept.ConceptWhat.StrCrptPltInnIds = "1";
concept.ConceptWhat.SubCategoryId = 1;
concept.ConceptWhen.ConceptId = 1;

concept.ConceptWhen.ProgramAporovalDueDate = DateTime.Now;
concept.ConceptWhen.TargetOncounterDate = DateTime.Now;
concept.ConceptWhere.Comment = "gud";
concept.ConceptWhere.ConceptId = 1;
concept.ConceptWhere.DistributionChannels = obj;
concept.ConceptWhere.DstrChnlCommaSeperated = "y";
concept.ConceptWhere.LocallyInpired = 1;
concept.ConceptWhere.QualifyDistributionChannel = "y";
concept.ConceptWhere.Regions = obj;
concept.ConceptWhere.RegionsCommaSeparated = "y";
concept.ConceptWho.Age = "";
concept.ConceptWho.CompetitiveBenchmark = "y";
concept.ConceptWho.ConceptId = 1;
var i = new List<int>();
concept.ConceptWho.MarketObjectiveIds = i;
concept.ConceptWho.PricingStrategy = "gd";
concept.ConceptWho.Income = "nice";
concept.ConceptWho.MarketObjectiveIds = i;
concept.ConceptWho.PricingStrategy = "aa";
concept.ConceptWho.Sex = 1;
concept.ConceptWho.SourceofSalesVolumeIds = obj;
concept.ConceptWho.StrMarketObjectiveIds = "1";
concept.ConceptWho.StrsourceofSalesVolumeIds = "1";
concept.ConceptWho.TargetCustomer = "1";
concept.ConceptWho.TargetMarketSize = 1;
concept.ConceptWho.TargetMrktOpportunity = "";
concept.ConceptWhy.BrandStrategyId = 1;
concept.ConceptWhy.ConceptId = 1;
concept.ConceptWhy.CrptStrategyCategoryId = "p";
concept.ConceptWhy.ProductCompetitiveAdv = "p";




currentresult = AboutBal.SaveUpdateAbout(concept);
// bool bb = false;
}
// Assert.AreEqual(currentresult.payload,expected);
//Assert.AreEqual<responsemessage>(null, currentresult.payload., "Insert Failed");
//Assert.AreEqual<responsemessage>(message,currentresult.payload);
Assert.AreEqual

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900