public void Post_Cancel_Operation_Should_Perform_Cancel_Operation_On_Meeting_With_ApproveSate()
        {
            #region Arrange
            //Create Meeting with Scheduled State
            var arrangeController = ServiceLocator.Current.GetInstance<MeetingsController>();
            MeetingControllerTest.CreateWorkingMeeting(DateTime.Now, 1);
            var context = new RMSContext();
            var currentMeeting = context.Meetings.First(); 
            var currentMeetingDto = arrangeController.GetAll().First();

            #endregion

            #region Act

            var actionController = ServiceLocator.Current.GetInstance<MeetingStateOperationsController>();
            actionController.Post(currentMeeting.Id, MeetingOperationEnum.Cancel);

            #endregion

            #region Assert

            var assertController = ServiceLocator.Current.GetInstance<MeetingsController>();
            var actualMeeting = assertController.Get(currentMeetingDto.Id);
            MeetingControllerTest.AreEqual_State(MeetingStateEnum.Approved, currentMeetingDto);
            MeetingControllerTest.AreEqual_State(MeetingStateEnum.Canceled, actualMeeting);
            #endregion

        }
 public MeetingReportRepository(RMSContext rmsContext)
 {
     this.ctx = rmsContext;
     meetingsAsNoTracking =
         ctx.Meetings.Include(m => m.Reminder)
             .Include(m => m.Files)
             .Include(m => m.CreatorUser)
             .AsNoTracking();
 }
示例#3
0
        public void Execute()
        {

            var container = new WindsorContainer().Install(FromAssembly.This());

            GlobalConfiguration.Configuration.Services.Replace(
                typeof(IHttpControllerActivator),
                new WindsorControllerActivator(container.Kernel));

            var locator = new WindsorServiceLocator(container);
            ServiceLocator.SetLocatorProvider(() => locator);

            var securityContext = new AuthContext();
            securityContext.Database.Initialize(true);

            var context = new RMSContext();
            context.Database.Initialize(true);
        }
示例#4
0
 public TaskRepository(RMSContext rmsContext)
 {
     this.ctx = rmsContext;
 }
示例#5
0
 public UserRepository(RMSContext rmsContext)
 {
     this.ctx = rmsContext;
 }
        public void GetAllByDeviceType_Should_GetAllUnSyncedFor_AndriodApp_SetSync_By_AndriodApp()
        {
            #region Arrange

            CreateWorkingMeeting(DateTime.Now, 1);
            CreateNoneWorkingMeeting(DateTime.Now.AddHours(4), 1); 

            #endregion

            #region Act

            var actionController=ServiceLocator.Current.GetInstance<MeetingsController>();
            var result=actionController.GetAll((int)AppType.AndriodApp);

            #endregion

            #region Assert

            var context = new RMSContext();
            var actualMembers = context.Meetings.ToList();

            if (actualMembers.Count != 2)
                Assert.Fail("it didnt create by sync correctly");

            if (actualMembers.Count(r => r.SyncedWithAndriodApp) != 2)
                Assert.Fail("Sync with andriod didnt set correctly");

            #endregion
        }
        public void PostMeetings_SyncFromDevice_Should_CreateMeeting_Working_Or_NoneWorking_ByAndriod()
        {
            #region Arrange

            var workingMeetingDto = createBaseMeetingDto(DateTime.Now, 1);
            workingMeetingDto.MeetingType = (int)MeetingType.Working;

            var noneWorkingMeetingDto = createBaseMeetingDto(DateTime.Now.AddHours(4), 1);
            noneWorkingMeetingDto.MeetingType = (int)MeetingType.NonWorking;

            var meetingSyncRequest = new MeetingSyncRequest
            {
                AppType = (int)AppType.AndriodApp,
                Items = new List<MeetingSyncItem>
                {
                    new MeetingSyncItem
                    {
                        Meeting = workingMeetingDto,
                        SyncId = Guid.NewGuid(),
                        ActionType = (int)EntityActionType.Create
                    },
                    new MeetingSyncItem
                    {
                        Meeting = noneWorkingMeetingDto,
                        SyncId = Guid.NewGuid(),
                        ActionType = (int)EntityActionType.Create
                    }
                }
            }; 

            #endregion

            #region Act

            var actionController = ServiceLocator.Current.GetInstance<MeetingsController>();
            actionController.PostMeetings(meetingSyncRequest, "forEhsan"); 

            #endregion

            #region Assert
            var context=new RMSContext();
            
           // var assertController = ServiceLocator.Current.GetInstance<MeetingsController>();
            var actualMembers = context.Meetings.ToList();

            if(actualMembers.Count!=2)
                Assert.Fail("it didnt create by sync correctly");
            if(actualMembers.Count(r=>meetingSyncRequest.Items.Select(i=>i.SyncId).Contains(r.SyncId))!=2)
                Assert.Fail("Sync Id didnt set correctly");
            if (actualMembers.Count(r => r.ActionType==EntityActionType.Create)!=2)
                Assert.Fail("ActionType didnt set correctly");
            if(actualMembers.Count(r => r.SyncedWithAndriodApp)!=2)
                Assert.Fail("Sync with andriod didnt set correctly");


            #endregion

        }