public void GetAvailableUsers_InTheMiddle() { // Arrange Seed.events = new List <Event>(); User user = new User("[email protected]", "", User.Roles.Photographer); string recordNumber = "123"; int oldUserCount = eventController.GetAvailableUsers(new List <User> { user }, DateTime.Now.AddDays(2), DateTime.Now.AddDays(3)).Count; var eventRequest = new EventRequest(recordNumber, new Client("Peter", "Pen", "238740291"), "Party", DateTime.Now, DateTime.Now.AddDays(5), 33, 321); eventController.Create(eventRequest); var eventTask = new EventTask("test description", user); eventController.CreateTask(recordNumber, eventTask); // Act var users = eventController.GetAvailableUsers(new List <User> { user }, DateTime.Now.AddDays(2), DateTime.Now.AddDays(3)); // Assert Assert.AreEqual(oldUserCount - 1, users.Count); }
public void UpdateEventRequestStatus_CreateEvent() { //Arrange EventRequestController eventRequestController = new EventRequestController(); //Act EventRequest eventRequest = eventRequestController.Create("123abc", new Client("", "", ""), "", DateTime.Now, DateTime.Now, 3, "23.4"); //Assert Assert.AreEqual(EventRequest.States.Created, eventRequest.State); }
public void UpdateEventRequestStatus_EditEvent() { //Arrange EventRequestController eventRequestController = new EventRequestController(); EventRequest eventRequest = eventRequestController.Create("123abc", new Client("", "", ""), "", DateTime.Now, DateTime.Now, 3, "23.4"); //Act eventRequestController.ChangeState(eventRequest, User.Roles.FinancialManager, "", true); //Assert Assert.AreEqual(EventRequest.States.FinancialFeedbackAdded, eventRequest.State); }
public void UpdateEventRequestStatus_ApproveRequest() { //Arrange EventRequestController eventRequestController = new EventRequestController(); EventRequest eventRequest = eventRequestController.Create("123abc", new Client("", "", ""), "", DateTime.Now, DateTime.Now, 3, "23.4"); //Act eventRequestController.ChangeState(eventRequest, User.Roles.SeniorCustomerServiceOfficer, "", true); //Assert Assert.AreEqual(EventRequest.States.ApprovedBySCSO, eventRequest.State); }
public void UpdateEventRequestStatus_ApproveEvent() { //Arrange EventRequestController eventRequestController = new EventRequestController(); EventRequest eventRequest = eventRequestController.Create("123abc", new Client("", "", ""), "", DateTime.Now, DateTime.Now, 3, "23.4"); //Act eventRequestController.ChangeState(eventRequest, User.Roles.AdministrationDepartmentManager, "", true); //Assert Assert.AreEqual(EventRequest.States.Finalized, eventRequest.State); }
public void CreateEventRequest_FromBiggerThanTo() { //Arrange EventRequestController eventRequestController = new EventRequestController(); int eventRequestCount = eventRequestController.GetEventRequests(User.Roles.SeniorCustomerServiceOfficer).Count; //Act EventRequest result = eventRequestController.Create("123abc", new Client("", "", ""), "", DateTime.Now.AddDays(1), DateTime.Now, 3, "23.4"); //Assert Assert.IsNull(result); Assert.AreEqual(eventRequestCount, eventRequestController.GetEventRequests(User.Roles.SeniorCustomerServiceOfficer).Count); }
public void CreateEventRequest_badBudget() { //Arrange EventRequestController eventRequestController = new EventRequestController(); int eventRequestCount = eventRequestController.GetEventRequests(User.Roles.SeniorCustomerServiceOfficer).Count; //Act EventRequest result = eventRequestController.Create("123abc", new Client("", "", ""), "", DateTime.Now, DateTime.Now, 3, "fdgdg"); //Assert Assert.IsNull(result); Assert.AreEqual(eventRequestCount, eventRequestController.GetEventRequests(User.Roles.SeniorCustomerServiceOfficer).Count); }
public void GetAllEvents() { // Arrange var eventRequest = new EventRequest("123", new Client("Peter", "Pen", "238740291"), "Party", DateTime.Now, DateTime.Now.AddDays(1), 33, 321); eventController.Create(eventRequest); // Act var events = eventController.GetEvents(); // Assert Assert.IsTrue(events.Count > 0); }
public void CreateTest() { // Arrange var eventRequest = new EventRequest("123", new Client("Peter", "Pen", "238740291"), "Party", DateTime.Now, DateTime.Now.AddDays(1), 33, 321); // Act var ev = eventController.Create(eventRequest); // Assert Assert.AreEqual(eventRequest.RecordNr, ev.RecordNr); Assert.AreEqual(eventRequest.Client.GetHashCode(), ev.Client.GetHashCode()); Assert.AreEqual(eventRequest.EventType, ev.EventType); Assert.AreEqual(eventRequest.From, ev.From); Assert.AreEqual(eventRequest.To, ev.To); Assert.AreEqual(eventRequest.Attendees, ev.Attendees); Assert.AreEqual(eventRequest.Budget, ev.Budget); }
public void GetUsersTasks() { // Arrange Seed.events = new List <Event>(); string recordNumber = "123"; User user = new User("[email protected]", "", User.Roles.Photographer); var eventRequest = new EventRequest(recordNumber, new Client("Peter", "Pen", "238740291"), "Party", DateTime.Now, DateTime.Now.AddDays(1), 33, 321); eventController.Create(eventRequest); var eventTask = new EventTask("test description", user); eventController.CreateTask(recordNumber, eventTask); // Act var tasks = eventController.GetTasks(user); // Assert Assert.AreEqual(1, tasks.Count); }
public void CreateTaskTest() { // Arrange string recordNumber = "123"; var eventRequest = new EventRequest(recordNumber, new Client("Peter", "Pen", "238740291"), "Party", DateTime.Now, DateTime.Now.AddDays(1), 33, 321); eventController.Create(eventRequest); User user = new User("[email protected]", "", User.Roles.Photographer); var eventTask = new EventTask("test description", user); // Act var ev = eventController.CreateTask(recordNumber, eventTask); // Assert Assert.IsTrue(ev.Tasks.Count == 1); Assert.IsNotNull(ev.Tasks.First().TaskID); Assert.AreEqual(eventTask.Description, ev.Tasks.First().Description); Assert.AreEqual(eventTask.AssignedTo.Email, ev.Tasks.First().AssignedTo.Email); }