Ejemplo n.º 1
0
        public async Task when_updating_item_the_application_should_navigate_to_UpdateItem_page()
        {
            var starpointsItem = CreateStarpointsItem();

            Authorize(starpointsItem, false);
            var component = CreateComponent(ComponentParameter.CreateParameter("Item", starpointsItem));

            component.WaitForState(() => component.Nodes?.Length > 0);
            component.Instance.UpdateItem();
            HasNavigatedToUrl.Should().Be($"/UpdateItem/{starpointsItem.Id}");
        }
        public async Task when_creating_an_item_with_this_user_createItem_service_should_navigate_to_this_users_points()
        {
            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();

            HasNavigatedToUrl.Should().Be("/Points/-1");
        }
Ejemplo n.º 3
0
        public async Task when_creating_an_item_the_user_should_navigate_to_createItem_page_with_userId_information()
        {
            MockHttp.Expect(HttpMethod.Get, "http://localhost/User/GetUser/17")
            .RespondValues(new UserObject {
                Id = 17, NumberOfpoints = 17
            });
            MockHttp.Expect(HttpMethod.Get, "http://localhost/StarpointsManager/GetStarpoints/17")
            .RespondValues(new[] { new StarpointsItem() });
            var target = CreateComponent(OtherUserIdParameter);
            await Task.Delay(50);

            target.Instance.CreateItem();
            HasNavigatedToUrl.Should().Be("/NewItem/17");
        }
        public async Task when_creating_an_item_with_an_other_user_createItem_service_should_navigate_to_the_users_points()
        {
            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(33);
            await target.Instance.UpdateOrCreate();

            HasNavigatedToUrl.Should().Be($"/Points/{userId}");
        }
        public async Task when_updating_an_item_with_an_other_user_updateItem_service_should_navigate_to_the_users_points()
        {
            const int userId = 17;

            InitializeHttpCallUpdateItem(11, userId);
            MockAuthorizationForStartechsWhichUserIsLeader();
            var target = CreateComponent(TestItemId);
            await Task.Delay(30);

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

            Console.WriteLine(target.Instance.User.Id);
            HasNavigatedToUrl.Should().Be($"/Points/{userId}");
        }