Example #1
0
        public async Task should_load_the_leaders_from_the_right_startechType_api()
        {
            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminLeader/Admin/GetLeaders").RespondValues(new UserObject[0]);
            var target = CreateComponent(StartechType, DisplayName);
            await Task.Delay(30);

            MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task for_updated_item_created_by_this_user_the_item_should_be_load_from_server()
        {
            InitializeHttpCallUpdateItem(11, 11);
            var target = CreateComponent(TestItemId);
            await Task.Delay(30);

            target.Instance.Item.Id.Should().Be(107);
            MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task for_updated_item_created_for_another_user_available_startech_should_be_retrieved_from_server()
        {
            InitializeHttpCallUpdateItem(15, 17);
            var target = CreateComponent(TestItemId);
            await Task.Delay(30);

            target.Instance.AvailableStartechs.Should().BeEquivalentTo(Startechs.Dotnet);
            MockHttp.VerifyNoOutstandingExpectation();
        }
Example #4
0
        public async Task when_removing_a_leader_the_right_startechtype_api_should_be_called()
        {
            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminLeader/Admin/GetLeaders").RespondValues(Users);
            var target = CreateComponent(StartechType, DisplayName);
            await Task.Delay(30);

            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminLeader/Admin/RemoveLeader/1").Respond(HttpStatusCode.OK);
            target.Instance.OnRemove(Users.First());
            MockHttp.VerifyNoOutstandingExpectation();
        }
Example #5
0
        public async Task should_load_startech_members_from_right_startech()
        {
            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminMember/Dotnet/GetMembers")
            .RespondValues(new[] { new UserObject {
                                       Id = 12, UserName = "******"
                                   } });
            var target = CreateComponent(StartechType);
            await Task.Delay(30);

            MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task when_creating_an_item_with_this_user_createItem_service_should_be_called_with_this_user_id()
        {
            InitializeHttpCallNewItem(ThisUserId);
            var target = CreateComponent(ThisUserId);
            await Task.Delay(30);

            MockHttp.Expect(HttpMethod.Post, "http://localhost/StarpointsManager/CreateStarpoints/-1").Respond(HttpStatusCode.OK);
            MockGetThisUserHttpRequest(ThisUserDatabaseId);
            await target.Instance.UpdateOrCreate();

            MockHttp.VerifyNoOutstandingExpectation();
        }
Example #7
0
        public async Task when_updating_status_the_update_status_api_method_should_be_called_for_new_status()
        {
            var starpointsItem = CreateStarpointsItem();

            Authorize(starpointsItem, false);
            MockHttp.Expect($"http://localhost/StarpointsManager/UpdateValidationStatus/-1/{starpointsItem.Id}/{ValidationState.Validated}").Respond(HttpStatusCode.OK);
            var component = CreateComponent(ComponentParameter.CreateParameter("Item", starpointsItem));

            component.WaitForState(() => component.Nodes?.Length > 0);
            await component.Instance.UpdateState(ValidationState.Validated);

            MockHttp.VerifyNoOutstandingExpectation();
        }
Example #8
0
        public async Task when_adding_a_leader_the_right_startechtype_api_should_be_called()
        {
            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminLeader/Admin/GetLeaders").RespondValues(Users);
            var target = CreateComponent(StartechType, DisplayName);
            await Task.Delay(30);

            var userObjectToAdd = new UserObject {
                Id = 5, UserName = "******"
            };

            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminLeader/Admin/AddLeader/5").Respond(HttpStatusCode.OK);
            target.Instance.AddUser(userObjectToAdd);
            MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task when_creating_an_item_with_an_other_user_createItem_service_should_be_called_with_the_user_id()
        {
            InitializeHttpCallNewItem(OtherUserId);
            MockAuthorizationForStartechsWhichUserIsLeader();
            var target = CreateComponent(OtherUserId);
            var userId = (int)OtherUserId.Value;
            await Task.Delay(30);

            target.Instance.Item.Startech = Startechs.Agile;
            MockHttp.Expect(HttpMethod.Post, $"http://localhost/StarpointsManager/CreateStarpoints/{userId}").Respond(HttpStatusCode.OK);
            MockGetThisUserHttpRequest(userId);
            await target.Instance.UpdateOrCreate();

            MockHttp.VerifyNoOutstandingExpectation();
        }
Example #10
0
        public async Task when_updating_status_the_update_status_api_method_should_be_called()
        {
            ConfirmDisplayer.Setup(x => x.Confirm(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.Factory.StartNew(() => true));
            var removeItemEventCallBack = EventCallbackFactory.Create <StarpointsItem>(new object(), _ => { });
            var starpointsItem          = CreateStarpointsItem();

            MockHttp.Expect($"http://localhost/StarpointsManager/CancelStarpoints/-1/{starpointsItem.Id}").Respond(HttpStatusCode.OK);
            Authorize(starpointsItem, false);
            var component = CreateComponent(ComponentParameter.CreateParameter("Item", starpointsItem)
                                            , ComponentParameter.CreateParameter("PleaseRemoveItem", removeItemEventCallBack));

            component.WaitForState(() => component.Nodes?.Length > 0);
            await component.Instance.CancelItem();

            await Task.Delay(30);

            MockHttp.VerifyNoOutstandingExpectation();
        }
Example #11
0
        public async Task when_adding_a_user_the_user_should_be_added()
        {
            var userObjectToAdd = new UserObject {
                Id = 12, UserName = "******"
            };

            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminMember/Dotnet/GetMembers")
            .RespondValues(new object [0]);
            var target = CreateComponent(StartechType);
            await Task.Delay(30);

            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminMember/Dotnet/SetMember/12")
            .Respond(HttpStatusCode.OK);
            MockHttp.Expect(HttpMethod.Get, "http://localhost/AdminMember/Dotnet/GetMembers")
            .RespondValues(new[] { userObjectToAdd });
            await target.Instance.Add(userObjectToAdd);

            MockHttp.VerifyNoOutstandingExpectation();
        }