public async Task languages_Delete_DoesDelete()
        {
            // Arrange
            string name        = Guid.NewGuid().ToString();
            string description = Guid.NewGuid().ToString();

            languages language = new languages
            {
                Name        = name,
                Description = description
            };


            await language.Create(dbContext).ConfigureAwait(false);

            // Act

            await language.Delete(dbContext);

            languages         dbLanguage        = dbContext.languages.AsNoTracking().First();
            language_versions dbLanguageVersion = dbContext.language_versions.AsNoTracking().First();

            // Assert
            Assert.NotNull(dbLanguage);
            Assert.NotNull(dbLanguageVersion);

            Assert.AreEqual(language.WorkflowState, Constants.WorkflowStates.Removed);
        }
Exemple #2
0
        public async Task Languages_Delete_DoesSetWorkflowStateToRemoved()
        {
            //Arrange

            languages language = new languages
            {
                Description = Guid.NewGuid().ToString(),
                Name        = Guid.NewGuid().ToString()
            };
            await language.Create(dbContext).ConfigureAwait(false);

            //Act
            DateTime?oldUpdatedAt = language.UpdatedAt;

            await language.Delete(dbContext);


            List <languages>         languages        = dbContext.languages.AsNoTracking().ToList();
            List <language_versions> languageVersions = dbContext.language_versions.AsNoTracking().ToList();

            Assert.NotNull(languages);
            Assert.NotNull(languageVersions);

            Assert.AreEqual(1, languages.Count());
            Assert.AreEqual(2, languageVersions.Count());

            Assert.AreEqual(language.CreatedAt.ToString(), languages[0].CreatedAt.ToString());
            Assert.AreEqual(language.Version, languages[0].Version);
//            Assert.AreEqual(language.UpdatedAt.ToString(), languages[0].UpdatedAt.ToString());
            Assert.AreEqual(languages[0].WorkflowState, Constants.WorkflowStates.Removed);
            Assert.AreEqual(language.Id, languages[0].Id);
            Assert.AreEqual(language.Description, languages[0].Description);
            Assert.AreEqual(language.Name, languages[0].Name);

            //Old Version
            Assert.AreEqual(language.CreatedAt.ToString(), languageVersions[0].CreatedAt.ToString());
            Assert.AreEqual(1, languageVersions[0].Version);
//            Assert.AreEqual(oldUpdatedAt.ToString(), languageVersions[0].UpdatedAt.ToString());
            Assert.AreEqual(languageVersions[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(language.Id, languageVersions[0].LanguageId);
            Assert.AreEqual(language.Description, languageVersions[0].Description);
            Assert.AreEqual(language.Name, languageVersions[0].Name);

            //New Version
            Assert.AreEqual(language.CreatedAt.ToString(), languageVersions[1].CreatedAt.ToString());
            Assert.AreEqual(language.Version, languageVersions[1].Version);
//            Assert.AreEqual(language.UpdatedAt.ToString(), languageVersions[1].UpdatedAt.ToString());
            Assert.AreEqual(languageVersions[1].WorkflowState, Constants.WorkflowStates.Removed);
            Assert.AreEqual(language.Id, languageVersions[1].LanguageId);
            Assert.AreEqual(language.Description, languageVersions[1].Description);
            Assert.AreEqual(language.Name, languageVersions[1].Name);
        }