public async Task Post_PlanningAppsInProgressTensApps(string url)
        {
            // Arrange
            var client = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    //Override IService called during POST to return specific test calendar
                    services.AddScoped <IDateService, DateServiceTest>();
                });
            })
                         .CreateClient();

            var testWebClient = new TestWebClient(client);

            testWebClient.Login();

            Console.WriteLine($"Calling Api Endpoint {url} ");

            var projectGenerators = await testWebClient.GetProjectGenerator();

            var pg = projectGenerators.Items.FirstOrDefault();
            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            await testWebClient.CreatePlanningApp(pg.Id);

            var PAL = await testWebClient.GetPlanningApps();

            Assert.True(PAL.Items.Count() == 10);
            Assert.True(PAL.TotalItems == 11);  //Check Paging Is Working
        }
        public async Task Post_AddNewGeneratorEndOfStateList(string url)
        {
            // Arrange
            var client = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    //Override IService called during POST to return specific test calendar
                    services.AddScoped <IDateService, DateServiceTest>();
                });
            })
                         .CreateClient();

            var testWebClient = new TestWebClient(client);

            testWebClient.Login();

            Console.WriteLine($"Calling Api Endpoint {url} ");
            var results = await testWebClient.GetPlanningApps();

            Assert.True(results.Items.Count() == 0);

            var projectGenerators = await testWebClient.GetProjectGenerator();

            var pg = projectGenerators.Items.FirstOrDefault();
            var planningAppResource = await testWebClient.CreatePlanningApp(pg.Id);

            Assert.Equal(planningAppResource.ProjectGeneratorName, TestSettings.ProjectGeneratorName);
            Assert.True(planningAppResource.PlanningAppStates.Count() == TestSettings.OneState);

            //Check Ordering
            var stateList = planningAppResource.PlanningAppStates.ToList();

            //Check Planning App Details
            Assert.Equal("03-01-2019", planningAppResource.CompletionDate);
            Assert.Equal("OnTime", planningAppResource.CurrentStateStatus);
            Assert.Equal("03-01-2019", stateList[0].DueByDate);

            //Loop states and check settings
            Assert.True(testWebClient.checkListOrdering(stateList));

            //Check new generator start flag
            Assert.True(stateList[0].isLastGeneratorState);
        }
示例#3
0
        public async Task Post_PlanningAppRollDateCheckStatus(string url)
        {
            var f = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    //Override IService called during POST to return specific test calendar
                    //services.AddScoped<IDateService, DateServiceTest>();
                });
            });


            // Arrange
            var client = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    //Override IService called during POST to return specific test calendar
                    //services.AddScoped<IDateService, DateServiceTest>();
                });
            })
                         .CreateClient();

            var testWebClient = new TestWebClient(client);

            testWebClient.Login();

            Console.WriteLine($"Calling Api Endpoint {url} ");
            var BD = await testWebClient.SetBusinessDate("01-01-2019");

            var projectGenerators = await testWebClient.GetProjectGenerator();

            var pg = projectGenerators.Items.FirstOrDefault();
            await testWebClient.CreatePlanningApp(pg.Id);

            var PAL = await testWebClient.GetPlanningApps();

            Assert.True(PAL.Items.Count() == 1);
            Assert.True(PAL.TotalItems == 1);  //Check Paging Is Working

            var PA = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);

            Assert.Equal(StatusList.OnTime, PA.CurrentStateStatus);
            Assert.Equal("TestGen1:State1", PA.CurrentState);
            Assert.Equal("03-01-2019", PA.ExpectedStateCompletionDate);
            Assert.Equal("15-01-2019", PA.CompletionDate);

            //Roll The Business Date To Make current state 'Due;
            BD = await testWebClient.SetBusinessDate("02-01-2019");

            var PA_ROLLED_DUE = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);

            //Assert Application Status is 'Due'
            Assert.Equal(StatusList.Due, PA_ROLLED_DUE.CurrentStateStatus);
            Assert.Equal("TestGen1:State1", PA_ROLLED_DUE.CurrentState);
            //Assert First State is 'Due;
            var stateList = PA_ROLLED_DUE.PlanningAppStates.ToList();

            Assert.Equal(StatusList.Due, stateList[0].StateStatus);
            Assert.Equal("TestGen1:State1", stateList[0].StateName);

            Assert.Equal(StatusList.OnTime, stateList[1].StateStatus);
            Assert.Equal("TestGen1:State2", stateList[1].StateName);

            //Assert Roll dates so first state 'Overdue' and second state 'Due'
            await testWebClient.SetBusinessDate("04-01-2019");

            var PA_ROLLED_OVERDUE_DUE = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);

            stateList = PA_ROLLED_OVERDUE_DUE.PlanningAppStates.ToList();
            //Assert Application Status is 'Due'
            Assert.Equal(StatusList.Overdue, PA_ROLLED_OVERDUE_DUE.CurrentStateStatus);
            Assert.Equal("TestGen1:State1", PA_ROLLED_OVERDUE_DUE.CurrentState);

            Assert.Equal(StatusList.Overdue, stateList[0].StateStatus);
            Assert.Equal("TestGen1:State1", stateList[0].StateName);

            Assert.Equal(StatusList.Due, stateList[1].StateStatus);
            Assert.Equal("TestGen1:State2", stateList[1].StateName);

            Assert.Equal(StatusList.OnTime, stateList[2].StateStatus);
            Assert.Equal("TestGen1:State3", stateList[2].StateName);

            //Assert All States overdue except last state 'Due'
            await testWebClient.SetBusinessDate("15-01-2019");

            var PA_ROLLED_ALL_OVERDUE_EX_LAST = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);

            stateList = PA_ROLLED_ALL_OVERDUE_EX_LAST.PlanningAppStates.ToList();
            Assert.Equal(StatusList.Overdue, PA_ROLLED_ALL_OVERDUE_EX_LAST.CurrentStateStatus);
            Assert.Equal("TestGen1:State1", PA_ROLLED_ALL_OVERDUE_EX_LAST.CurrentState);

            var TOT_OVERDUE = stateList.Where(s => s.StateStatus == StatusList.Overdue).Count();;

            Assert.Equal(4, TOT_OVERDUE);
            Assert.Equal(StatusList.Due, stateList[4].StateStatus);
            Assert.Equal("TestGen1:State5", stateList[4].StateName);


            //Assert All States overdue
            await testWebClient.SetBusinessDate("16-01-2019");

            var PA_ROLLED_ALL_OVERDUE = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);

            stateList = PA_ROLLED_ALL_OVERDUE.PlanningAppStates.ToList();
            Assert.Equal(StatusList.Overdue, PA_ROLLED_ALL_OVERDUE.CurrentStateStatus);
            Assert.Equal("TestGen1:State1", PA_ROLLED_ALL_OVERDUE.CurrentState);

            Assert.True(stateList.All(s => s.StateStatus == StatusList.Overdue));
        }
示例#4
0
        public async Task Post_PlanningAppNextStateTests(string url)
        {
            var f = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    //Override IService called during POST to return specific test calendar
                    //services.AddScoped<IDateService, DateServiceTest>();
                });
            });


            // Arrange
            var client = _factory.WithWebHostBuilder(builder =>
            {
                builder.ConfigureTestServices(services =>
                {
                    //Override IService called during POST to return specific test calendar
                    //services.AddScoped<IDateService, DateServiceTest>();
                });
            })
                         .CreateClient();

            var testWebClient = new TestWebClient(client);

            testWebClient.Login();

            Console.WriteLine($"Calling Api Endpoint {url} ");
            var BD = await testWebClient.SetBusinessDate("01-01-2019");

            var projectGenerators = await testWebClient.GetProjectGenerator();

            var pg = projectGenerators.Items.FirstOrDefault();
            await testWebClient.CreatePlanningApp(pg.Id);

            var PAL = await testWebClient.GetPlanningApps();

            Assert.True(PAL.Items.Count() == 1);
            Assert.True(PAL.TotalItems == 1);  //Check Paging Is Working

            var PA = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);

            Assert.Equal(StatusList.OnTime, PA.CurrentStateStatus);
            Assert.Equal(StatusList.AppInProgress, PA.PlanningStatus);
            Assert.Equal("TestGen1:State1", PA.CurrentState);
            Assert.Equal("03-01-2019", PA.ExpectedStateCompletionDate);
            Assert.Equal("15-01-2019", PA.CompletionDate);

            var NEXT_STATE_PA = await testWebClient.NextState(PA.Id);

            Assert.Equal(StatusList.OnTime, NEXT_STATE_PA.CurrentStateStatus);
            Assert.Equal("TestGen1:State2", NEXT_STATE_PA.CurrentState);
            Assert.Equal("TestGen1:State3", NEXT_STATE_PA.NextState);
            Assert.Equal("07-01-2019", NEXT_STATE_PA.ExpectedStateCompletionDate);
            Assert.Equal("15-01-2019", NEXT_STATE_PA.CompletionDate);

            var stateList = NEXT_STATE_PA.PlanningAppStates.ToList();

            Assert.Equal(StatusList.Complete, stateList[0].StateStatus);
            Assert.Equal("TestGen1:State1", stateList[0].StateName);
            Assert.Equal("01-01-2019", stateList[0].DateCompleted);
            Assert.Equal(StatusList.OnTime, stateList[1].StateStatus);
            Assert.Equal("TestGen1:State2", stateList[1].StateName);

            var COMPLETE_ALL_BUT_LAST_STATE_PA = await testWebClient.NextState(PA.Id);

            COMPLETE_ALL_BUT_LAST_STATE_PA = await testWebClient.NextState(PA.Id);

            COMPLETE_ALL_BUT_LAST_STATE_PA = await testWebClient.NextState(PA.Id);

            Assert.Equal(StatusList.OnTime, COMPLETE_ALL_BUT_LAST_STATE_PA.CurrentStateStatus);
            Assert.Equal("TestGen1:State5", COMPLETE_ALL_BUT_LAST_STATE_PA.CurrentState);
            //Assert All other States are Complete
            var stateListCtr = COMPLETE_ALL_BUT_LAST_STATE_PA.PlanningAppStates.ToList().Where(s => s.StateStatus == StatusList.Complete);

            Assert.Equal(4, stateListCtr.Count());

            Assert.Null(COMPLETE_ALL_BUT_LAST_STATE_PA.NextState);

            //Assert Complete State
            var COMPLETE_PA = await testWebClient.NextState(PA.Id);

            Assert.Equal(StatusList.Complete, COMPLETE_PA.PlanningStatus);
            Assert.Null(COMPLETE_PA.CurrentState);
            Assert.Null(COMPLETE_PA.CurrentStateStatus);

            //Roll The Business Date To Make current state 'Due;
            // BD = await testWebClient.SetBusinessDate("02-01-2019");
            // var PA_ROLLED_DUE = await testWebClient.GetPlanningApp(PAL.Items.SingleOrDefault().Id);
        }