예제 #1
0
        public void UserTest()
        {
            User testUser = GetSimpleUser();

            //Test if naming works correct
            Assert.ThrowsException <ArgumentException>(() => { testUser.FirstName = "Bob1"; }, "FirstName can only contains letter and spaces");
            Assert.ThrowsException <ArgumentException>(() => { testUser.LastName = "Bob1"; }, "LastName can only contains letter and spaces");
            Assert.ThrowsException <ArgumentException>(() => { testUser.FirstName = string.Empty; }, "FirstName cannot be empty");
            Assert.ThrowsException <ArgumentException>(() => { testUser.LastName = string.Empty; }, "LastName cannot be empty");

            //Test descritption
            Assert.ThrowsException <ArgumentException>(() => { testUser.Description = null; }, "Description is not supposed to be able to be empty");

            //Test picture uri
            Assert.ThrowsException <ArgumentException>(() => { testUser.PictureUri = "data:image/pn;base63,aaa"; }, "Picture URI should not be able to contain invalid pictures");
            Assert.ThrowsException <ArgumentException>(() => { testUser.PictureUri = string.Empty; }, "PictureUri cannot be empty");

            //Test null address
            testUser.Address = AddressTests.GetSimpleAddress();
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.Address = null; }, "Events cannot be null");

            //Test if lists can be null
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.Events = null; }, "Events cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.Invites = null; }, "EventsUsers cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.Meetings = null; }, "Meetings cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.Meetings1 = null; }, "Meetings1 cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.UsersBusinesses = null; }, "UsersBusinesses cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.UsersInterests = null; }, "UsersInterests cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.UsersOrganizations = null; }, "UsersOrganizations cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.Wishes = null; }, "Wishes cannot be null");
            Assert.ThrowsException <ArgumentNullException>(() => { testUser.UserPauses = null; }, "UserPauses cannot be null");
        }
예제 #2
0
 /// <summary>
 /// Creates a simple <see cref="Event"/> object
 /// </summary>
 /// <param name="eventId">The id the event should have</param>
 /// <param name="ownerId">The id the event owner should have</param>
 /// <returns>A simple <see cref="Event"/></returns>
 public static Event GetSimpleEvent(int eventId = 0, int ownerId = 0)
 {
     return(new Event("My 1st Event", "My 783945uisdfsf{[]{£@$@$ event description", UserTests.GetSimpleUser(ownerId), AddressTests.GetSimpleAddress(), eventId));
 }
예제 #3
0
 /// <summary>
 /// Creates an simple <see cref="User"/> object
 /// </summary>
 /// <param name="userId">The id the user should have</param>
 /// <returns>An simple <see cref="User"/></returns>
 public static User GetSimpleUser(int userId = 0)
 {
     return(new User("Bob", "Bobsen", "Hello, I'm bob", "data:image/png;base64,aaa", "[email protected]", AddressTests.GetSimpleAddress(), userId));
 }