public void PartyRepository_AddParty_ShoulAddPartyToList() { //--Arrange _partyRepo.AddParty(new Party()); List <Party> parties = _partyRepo.GetParties(); //--Act int actual = parties.Count; int expected = 1; //--Assert Assert.AreEqual(expected, actual); }
public int AddParty(PublishPartyInfo partyInfo) { var user = UserRepository.GetUserByOpenId(partyInfo.OpenId); var party = new DUOJU_PARTIES { DUOJU_SUPPLIERS = SupplierRepository.GetSupplierById(partyInfo.SupplierId.Value), DUOJU_USERS = user, HOLD_DATE = partyInfo.HoldDate.Value, HOLD_TIME = (int)partyInfo.HoldTime.Value, DESCRIPTION = partyInfo.Description, MIN_INTO_FORCE = partyInfo.MinIntoForce.Value, MAX_INTO_FORCE = partyInfo.MaxIntoForce, STATUS = (int)PartyStatuses.PUBLISHED, CREATE_BY = user.USER_ID, CREATE_TIME = DateTime.Now, LAST_UPDATE_BY = user.USER_ID, LAST_UPDATE_TIME = DateTime.Now }; party.DUOJU_PARTY_PARTICIPANTS.Add(new DUOJU_PARTY_PARTICIPANTS { DUOJU_USERS = user, PARTICIPATE_TIME = DateTime.Now, STATUS = (int)PartyParticipantStatuses.PARTICIPATED, CREATE_BY = user.USER_ID, CREATE_TIME = DateTime.Now, LAST_UPDATE_BY = user.USER_ID, LAST_UPDATE_TIME = DateTime.Now }); PartyRepository.AddParty(party); PartyRepository.SaveChanges(); return(party.PARTY_ID); }
public void AddParty(Party newParty) { partyRepos.AddParty(Mapping.PartyContractToDb(newParty)); }