Click here to Skip to main content
15,499,802 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
Member 924543130-Jul-14 1:38
MemberMember 924543130-Jul-14 1:38 
GeneralRe: How to retain Dropdownlist value after selectedindexchanged and postback?? Pin
lan160730-Jul-14 20:35
Memberlan160730-Jul-14 20:35 
Questiontag clipboard text Pin
Jassim Rahma27-Jul-14 12:59
MemberJassim Rahma27-Jul-14 12:59 
AnswerRe: tag clipboard text Pin
Garth J Lancaster27-Jul-14 14:20
professionalGarth J Lancaster27-Jul-14 14:20 
Questionhow do i get a table in gridview according to combobox fields? Pin
Sajeev Unni27-Jul-14 8:29
MemberSajeev Unni27-Jul-14 8:29 
AnswerRe: how do i get a table in gridview according to combobox fields? Pin
Pete O'Hanlon27-Jul-14 9:09
mvaPete O'Hanlon27-Jul-14 9:09 
AnswerRe: how do i get a table in gridview according to combobox fields? Pin
Swinkaran28-Jul-14 20:09
professionalSwinkaran28-Jul-14 20:09 
QuestionMVC unit testing Pin
Marsh8727-Jul-14 4:09
MemberMarsh8727-Jul-14 4:09 
VB
I started to learn how to write mvc tests  from the following site http://www.asp.net/mvc/tutorials/older-versions/contact-manager/iteration-5-create-unit-tests-cs"

However when running the test I keep getting a object not set to instance exception  


 [TestMethod]
        public void CreateRace()
        {




            //Arrange

            RACE race = new RACE();

            race.RACE_CODE = 1;
            race.Logourl = "dasdad";
            race.RegattaCity = "Durban";
            race.RegattaProvince = "Kzn";
            race.RegattaStreetAddress = "232Chats";
            race.MAXPARTICA = 12;
            race.SECRETARY_EMAIL = "ssasda";
            race.SECRETARY_MOBILE = 1422434;
            race.SECRETARY_NAME = "jsjsjs";

            race.ENTRYAMOUNT = Convert.ToDecimal(23.58);

            race.EVENT_NAME = "sadada";
            race.status = "Active";
            race.UserId = 1;

            race.LATEENTRYAMOUNT = Convert.ToDecimal(23.58);

            string eventstart = "2014/05/12 12:02", eventend = "2014/05/17 12:02", entrydeadline = "2014/05/11 12:02", withdrawdate = "2014/05/11 12:02", YachtClubname = "durban";

            //Act
            var result = _service.CreateRace(race, eventstart, eventend, entrydeadline, withdrawdate, YachtClubname, "Kzn");




            //Assert

            Assert.IsTrue(result);
}

//Create Service Method
C#
public bool CreateRace(RACE race, string eventstart, string eventend, string entrydeadline, string withdrawaldate,string YachtClubname,string Province )
      {

          if (!ValidateRace( race,eventstart,  eventend,  entrydeadline, withdrawaldate,YachtClubname,Province))
              return false;

          // Database logic
          try
          {
              _repository.CreateRace(race, eventstart, eventend,  entrydeadline, withdrawaldate,YachtClubname,Province);

          }
          catch
          {
              return false;
          }
          return true;
      }

AnswerRe: MVC unit testing Pin
Pete O'Hanlon27-Jul-14 4:41
mvaPete O'Hanlon27-Jul-14 4:41 
AnswerRe: MVC unit testing Pin
Marsh8727-Jul-14 9:52
MemberMarsh8727-Jul-14 9:52 
GeneralRe: MVC unit testing Pin
Pete O'Hanlon27-Jul-14 11:02
mvaPete O'Hanlon27-Jul-14 11:02 
GeneralRe: MVC unit testing Pin
Dave Kreskowiak27-Jul-14 11:03
mveDave Kreskowiak27-Jul-14 11:03 
GeneralRe: MVC unit testing Pin
User 571134828-Jul-14 1:54
MemberUser 571134828-Jul-14 1:54 
QuestionMouse set in the form Pin
PozzaVecia27-Jul-14 2:47
MemberPozzaVecia27-Jul-14 2:47 
AnswerRe: Mouse set in the form Pin
Pete O'Hanlon27-Jul-14 2:53
mvaPete O'Hanlon27-Jul-14 2:53 
GeneralRe: Mouse set in the form Pin
PozzaVecia27-Jul-14 3:13
MemberPozzaVecia27-Jul-14 3:13 
AnswerRe: Mouse set in the form Pin
OriginalGriff27-Jul-14 3:34
mveOriginalGriff27-Jul-14 3:34 
AnswerRe: Mouse set in the form Pin
User 873938131-Jul-14 0:44
MemberUser 873938131-Jul-14 0:44 
GeneralProblem with Windows forms monthcalendar control Pin
Member 1094245026-Jul-14 20:17
MemberMember 1094245026-Jul-14 20:17 
GeneralRe: Problem with Windows forms monthcalendar control Pin
OriginalGriff26-Jul-14 22:33
mveOriginalGriff26-Jul-14 22:33 
GeneralRe: Problem with Windows forms monthcalendar control Pin
Pete O'Hanlon27-Jul-14 2:44
mvaPete O'Hanlon27-Jul-14 2:44 
GeneralRe: Problem with Windows forms monthcalendar control Pin
OriginalGriff27-Jul-14 3:29
mveOriginalGriff27-Jul-14 3:29 
GeneralRe: Problem with Windows forms monthcalendar control Pin
Member 1094245027-Jul-14 8:00
MemberMember 1094245027-Jul-14 8:00 
GeneralRe: Problem with Windows forms monthcalendar control Pin
OriginalGriff27-Jul-14 22:09
mveOriginalGriff27-Jul-14 22:09 
GeneralRe: Problem with Windows forms monthcalendar control Pin
Pete O'Hanlon26-Jul-14 22:34
mvaPete O'Hanlon26-Jul-14 22:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.