public void GetTributeOnIdTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value int UserId = InsertDummyUser("tj_op"); int tributeId = 0; GetMyTributes _objtribute = new GetMyTributes(); _objtribute.UserId = UserId; object[] _param = { _objtribute, 0, 1, 1 }; if (_objtribute.CustomError == null) { List<GetMyTributes> Mytributes = new List<GetMyTributes>(); Mytributes = target.GetMyTributes(_param); Assert.AreEqual(true, Mytributes.Count > 0); tributeId = Mytributes[0].TributeId; } TributesUserInfo _objTributeUserinfo = new TributesUserInfo(); // TODO: Initialize to an appropriate value _objTributeUserinfo.Tributes = new Tributes(); _objTributeUserinfo.Tributes.TributeId = tributeId; target.GetTributeOnId(_objTributeUserinfo); //Write Asserts here once the stored procedure is fixed //Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void UpdateEmailAlertsTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value int UserId = InsertDummyUser("tj_op"); //////////////////////////Get tribute of type 0 for userId////GetMyTributes unit test// int tributeId = 0; GetMyTributes _objtribute = new GetMyTributes(); _objtribute.UserId = UserId; object[] _param = { _objtribute, 0, 1, 1 }; if (_objtribute.CustomError == null) { List<GetMyTributes> Mytributes = new List<GetMyTributes>(); Mytributes = target.GetMyTributes(_param); Assert.AreEqual(true, Mytributes.Count > 0); tributeId = Mytributes[0].TributeId; } /////////////////////////// Tributes objTribute = new Tributes(); objTribute.UserTributeId = UserId; objTribute.TributeId = tributeId; objTribute.IsActive = false; object[] _Tributes = { objTribute }; // TODO: Initialize to an appropriate value target.UpdateEmailAlerts(_Tributes); /////GetMyTribute Unit test///// GetMyTributes objtribute = new GetMyTributes(); objtribute.UserId = UserId; object[] param = { objtribute, tributeId }; List<GetMyTributes> mytribute = target.GetMyTribute(param); Assert.AreEqual(mytribute[0].TributeId, tributeId); if (mytribute[0].TributeId == tributeId) { Assert.AreEqual(false, mytribute[0].EmailAlert); } //Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void GetTributeByIDTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value int UserId = InsertDummyUser("tj_op"); int tributeId = 0; GetMyTributes _objtribute = new GetMyTributes(); _objtribute.UserId = UserId; object[] _param = { _objtribute, 0, 1, 2 }; if (_objtribute.CustomError == null) { List<GetMyTributes> Mytributes = new List<GetMyTributes>(); Mytributes = target.GetMyTributes(_param); Assert.AreEqual(true, Mytributes.Count > 0); tributeId = Mytributes[0].TributeId; } TributesUserInfo _objTributeUserinfo = new TributesUserInfo(); // TODO: Initialize to an appropriate value _objTributeUserinfo.Tributes = new Tributes(); _objTributeUserinfo.Tributes.TributeId = tributeId; target.GetTributeByID(_objTributeUserinfo); Assert.AreEqual("tj", _objTributeUserinfo.Tributes.TributeName); Assert.AreEqual("xyz", _objTributeUserinfo.Tributes.TributeUrl); Assert.AreEqual("Birthday", _objTributeUserinfo.Tributes.TypeDescription); Assert.AreEqual("tj", _objTributeUserinfo.Tributes.TributeName); Assert.AreEqual("11-03-1983 AM 12:00:00", _objTributeUserinfo.Tributes.Date1.ToString()); //Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void IsUserOwnerTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value //UserAdminOwnerInfo objUserInfo = null; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; UserAdminOwnerInfo objUserInfo = new UserAdminOwnerInfo(); int UserId = InsertDummyUser("tj_op"); objUserInfo.UserId = UserId; //Find Tributes for User ID int tributeId = 0; GetMyTributes _objtribute = new GetMyTributes(); _objtribute.UserId = UserId; object[] _param = { _objtribute, 0, 1, 1 }; if (_objtribute.CustomError == null) { List<GetMyTributes> Mytributes = new List<GetMyTributes>(); Mytributes = target.GetMyTributes(_param); Assert.AreEqual(true, Mytributes.Count > 0); tributeId = Mytributes[0].TributeId; } objUserInfo.TributeId = tributeId; //FINd Photo Album ID for Tribute id object[] objParam = { tributeId }; DataSet dsPhotoAlbumList = GetDataSet("usp_GetPhotoAlbumListInTribute", objParam); List<PhotoAlbum> objListOfPhotoAlbum = new List<PhotoAlbum>(); //to fill records in the Photo Gallery list if (dsPhotoAlbumList.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsPhotoAlbumList.Tables[0].Rows) { PhotoAlbum objAlbum = new PhotoAlbum(); objAlbum.PhotoAlbumId = int.Parse(dr["PhotoAlbumId"].ToString()); objListOfPhotoAlbum.Add(objAlbum); objAlbum = null; } } int PhotoAlbumId = 0; if (objListOfPhotoAlbum.Count > 0) { PhotoAlbumId = objListOfPhotoAlbum[0].PhotoAlbumId; } //Get Photo id in PhotoAlbumId///////////// List<Photos> objListPhotos = new List<Photos>(); try { object[] objParam1 = {PhotoAlbumId, 1, 1, "ASC" }; DataSet dsPhotos = GetDataSet("usp_GetPhotos", objParam1); int totalRecords = 0; //objGetPhotos.SortOrder if (dsPhotos.Tables[0].Rows.Count > 0) { DataRow dr = dsPhotos.Tables[0].Rows[0]; totalRecords = int.Parse(dr["TotalRecords"].ToString()); } //to fill records in the Photo list if (dsPhotos.Tables[1].Rows.Count > 0) { foreach (DataRow dr in dsPhotos.Tables[1].Rows) { Photos objPhoto = new Photos(); objPhoto.PhotoId = int.Parse(dr["UserPhotoId"].ToString()); objPhoto.PhotoAlbumId = int.Parse(dr["PhotoAlbumId"].ToString()); objPhoto.PhotoImage = dr["PhotoImage"].ToString(); objPhoto.CommentCount = int.Parse(dr["CommentCount"].ToString()); objPhoto.CreatedDate = DateTime.Parse(dr["CreatedDate"].ToString()); objPhoto.TotalRecords = totalRecords; objListPhotos.Add(objPhoto); objPhoto = null; } } } catch (Exception ex) { throw ex; } ////////////////////////////////////////// objUserInfo.TypeId = objListPhotos[0].PhotoId; objUserInfo.TypeName = "ManagePhoto"; actual = target.IsUserOwner(objUserInfo); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); }