Пример #1
0
        private async void CategoryOfPersonERL_TestNewCategoryOfPersonERL()
        {
            var categoryOfPersonEdit = await CategoryOfPersonERL.NewCategoryOfPersonERL();

            Assert.NotNull(categoryOfPersonEdit);
            Assert.IsType <CategoryOfPersonERL>(categoryOfPersonEdit);
        }
Пример #2
0
        private async void CategoryOfPersonERL_TestGetCategoryOfPersonERL()
        {
            var categoryOfPersonEdit =
                await CategoryOfPersonERL.GetCategoryOfPersonERL();

            Assert.NotNull(categoryOfPersonEdit);
            Assert.Equal(3, categoryOfPersonEdit.Count);
        }
Пример #3
0
        private async void CategoryOfPersonERL_TestAddCategoryOfPersonERL()
        {
            var categoryList =
                await CategoryOfPersonERL.GetCategoryOfPersonERL();

            var countBeforeAdd = categoryList.Count;

            var categoryOfPersonToAdd = categoryList.AddNew();

            BuildCategoryOfPerson(categoryOfPersonToAdd);

            var updatedCategoryList = await categoryList.SaveAsync();

            Assert.NotEqual(countBeforeAdd, updatedCategoryList.Count);
        }
Пример #4
0
        private async void CategoryOfPersonERL_TestUpdateCategoryOfPersonERL()
        {
            const int ID_TO_UPDATE = 1;

            var categoryList =
                await CategoryOfPersonERL.GetCategoryOfPersonERL();

            var countBeforeUpdate        = categoryList.Count;
            var categoryOfPersonToUpdate = categoryList.First(cl => cl.Id == ID_TO_UPDATE);

            categoryOfPersonToUpdate.Category = "Updated category";

            var updatedList = await categoryList.SaveAsync();

            Assert.Equal(countBeforeUpdate, updatedList.Count);
        }
Пример #5
0
        private async void CategoryOfPersonERL_TestDeleteCategoryOfPersonERL()
        {
            const int ID_TO_DELETE = 99;
            var       categoryList =
                await CategoryOfPersonERL.GetCategoryOfPersonERL();

            var listCount        = categoryList.Count;
            var categoryToDelete = categoryList.First(cl => cl.Id == ID_TO_DELETE);
            // remove is deferred delete
            var isDeleted = categoryList.Remove(categoryToDelete);

            var categoryOfPersonListAfterDelete = await categoryList.SaveAsync();

            Assert.NotNull(categoryOfPersonListAfterDelete);
            Assert.IsType <CategoryOfPersonERL>(categoryOfPersonListAfterDelete);
            Assert.True(isDeleted);
            Assert.NotEqual(listCount, categoryOfPersonListAfterDelete.Count);
        }