Exemple #1
0
        public async Task CREATE_NEW()
        {
            var isSetup = false;

            await Setup();

            try
            {
                isSetup = true;
                var isCreated    = false;
                var languageEdit = await LanguageEdit.NewLanguageEditAsync();

                isCreated = true;

                EnqueueConditional(() => isSetup);
                EnqueueConditional(() => isCreated);
                EnqueueCallback(() => Assert.IsNotNull(languageEdit));
                EnqueueCallback(() => Assert.AreNotEqual(Guid.Empty, languageEdit.UserId));

                EnqueueTestComplete();
            }
            finally
            {
                Teardown();
            }
        }
        private async Task InitializeModelAsync()
        {
            #region Thinking
            var thinkId = System.Guid.NewGuid();
            History.Events.ThinkingAboutTargetEvent.Publish(thinkId);
            #endregion
            var newLanguage = await LanguageEdit.NewLanguageEditAsync();

            #region Thinked
            History.Events.ThinkedAboutTargetEvent.Publish(thinkId);
            #endregion

            var languageViewModel = Services.Container.GetExportedValue <AddLanguageLanguageEditViewModel>();
            languageViewModel.Model = newLanguage;
            LanguageViewModel       = languageViewModel;
        }
Exemple #3
0
        public async Task NEW_EDIT_BEGINSAVE_GET()
        {
            #region Setup (try..)
            var isAsyncComplete = false;
            var isSetup         = false;
            await Setup();

            try
            {
                isSetup = true;
                EnqueueConditional(() => isSetup);
                #endregion
                //NEW
                var languageEdit = await LanguageEdit.NewLanguageEditAsync();

                //EDIT
                languageEdit.Text = "TestLanguage_NEW_EDIT_BEGINSAVE_GET";

                //SAVE
                var savedLanguageEdit = await languageEdit.SaveAsync();

                //GET (CONFIRM SAVE)
                var gottenLanguageEdit = await LanguageEdit.GetLanguageEditAsync(savedLanguageEdit.Id);

                isAsyncComplete = true;

                EnqueueConditional(() => isAsyncComplete);

                EnqueueCallback(() => Assert.IsNotNull(languageEdit));
                EnqueueCallback(() => Assert.IsNotNull(savedLanguageEdit));
                EnqueueCallback(() => Assert.IsNotNull(gottenLanguageEdit));
                EnqueueCallback(() => Assert.AreNotEqual(languageEdit.Id, savedLanguageEdit.Id));
                EnqueueCallback(() => Assert.AreEqual(savedLanguageEdit.Id, gottenLanguageEdit.Id));
                EnqueueCallback(() => Assert.AreEqual(savedLanguageEdit.Text, gottenLanguageEdit.Text));

                EnqueueTestComplete();

                #region (...finally) Teardown
            }
            finally
            {
                Teardown();
            }
            #endregion
        }
Exemple #4
0
        public async Task NEW_EDIT_BEGINSAVE_GET_DELETE_GET()
        {
            #region Setup (try..)
            var isAsyncComplete = false;
            EnqueueConditional(() => isAsyncComplete);
            await Setup();

            try
            {
                #endregion
                LanguageEdit languageEdit        = null;
                LanguageEdit savedLanguageEdit   = null;
                LanguageEdit gottenLanguageEdit  = null;
                LanguageEdit deletedLanguageEdit = null;

                //INITIALIZE TO EMPTY LANGUAGE EDIT, BECAUSE WE EXPECT THIS TO BE NULL LATER
                LanguageEdit deleteConfirmedLanguageEdit = new LanguageEdit();

                //NEW
                languageEdit = await LanguageEdit.NewLanguageEditAsync();

                //EDIT
                languageEdit.Text = "TestLanguage";

                //SAVE
                savedLanguageEdit = await languageEdit.SaveAsync();

                //GET (CONFIRM SAVE)
                gottenLanguageEdit = await LanguageEdit.GetLanguageEditAsync(savedLanguageEdit.Id);

                //DELETE (MARKS DELETE.  SAVE INITIATES ACTUAL DELETE IN DB)
                gottenLanguageEdit.Delete();
                deletedLanguageEdit = await gottenLanguageEdit.SaveAsync();

                EnqueueTestComplete();

                try
                {
                    deleteConfirmedLanguageEdit = await LanguageEdit.GetLanguageEditAsync(deletedLanguageEdit.Id);

                    throw new Exception();
                }
                catch (Csla.DataPortalException dpex)
                {
                    //WE ARE EXPECTING ONLY ID NOT FOUND EXCEPTIONS
                    if (!TestsHelper.IsIdNotFoundException(dpex))
                    {
                        throw dpex;
                    }

                    Assert.IsNotNull(languageEdit);
                    Assert.IsNotNull(savedLanguageEdit);
                    Assert.IsNotNull(gottenLanguageEdit);
                    Assert.IsNotNull(deletedLanguageEdit);
                    Assert.AreEqual(Guid.Empty, deleteConfirmedLanguageEdit.Id);
                    Assert.AreEqual(string.Empty, deleteConfirmedLanguageEdit.Text);
                    Assert.AreEqual(Guid.Empty, deleteConfirmedLanguageEdit.UserId);
                    Assert.AreEqual(string.Empty, deleteConfirmedLanguageEdit.Username);
                }
                #region (...finally) Teardown
            }
            finally
            {
                Teardown();
                isAsyncComplete = true;
            }
            #endregion
        }