public async Task Options_Delete_DoesSetWorkflowStateToRemoved()
        {
            Random rnd = new Random();

            bool randomBool = rnd.Next(0, 2) > 0;

            question_sets questionSet = new question_sets
            {
                Name            = Guid.NewGuid().ToString(),
                Share           = randomBool,
                HasChild        = randomBool,
                PosiblyDeployed = randomBool
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            questions question = new questions
            {
                Image             = randomBool,
                Maximum           = rnd.Next(1, 255),
                Minimum           = rnd.Next(1, 255),
                Prioritised       = randomBool,
                Type              = Guid.NewGuid().ToString(),
                FontSize          = Guid.NewGuid().ToString(),
                ImagePosition     = Guid.NewGuid().ToString(),
                MaxDuration       = rnd.Next(1, 255),
                MinDuration       = rnd.Next(1, 255),
                QuestionIndex     = rnd.Next(1, 255),
                QuestionType      = Guid.NewGuid().ToString(),
                RefId             = rnd.Next(1, 255),
                ValidDisplay      = randomBool,
                BackButtonEnabled = randomBool,
                QuestionSetId     = questionSet.Id
            };
            await question.Create(dbContext).ConfigureAwait(false);

            options option = new options
            {
                Weight       = rnd.Next(1, 255),
                OptionsIndex = rnd.Next(1, 255),
                WeightValue  = rnd.Next(1, 255),
                QuestionId   = question.Id
            };
            await option.Create(dbContext).ConfigureAwait(false);

            //Act

            DateTime?oldUpdatedAt = option.UpdatedAt;

            await option.Delete(dbContext);

            List <options>         options        = dbContext.options.AsNoTracking().ToList();
            List <option_versions> optionVersions = dbContext.option_versions.AsNoTracking().ToList();

            Assert.NotNull(options);
            Assert.NotNull(optionVersions);

            Assert.AreEqual(1, options.Count());
            Assert.AreEqual(2, optionVersions.Count());

            Assert.AreEqual(option.CreatedAt.ToString(), options[0].CreatedAt.ToString());
            Assert.AreEqual(option.Version, options[0].Version);
//            Assert.AreEqual(option.UpdatedAt.ToString(), options[0].UpdatedAt.ToString());
            Assert.AreEqual(options[0].WorkflowState, Constants.WorkflowStates.Removed);
            Assert.AreEqual(option.Id, options[0].Id);
            Assert.AreEqual(option.Weight, options[0].Weight);
            Assert.AreEqual(option.OptionsIndex, options[0].OptionsIndex);
            Assert.AreEqual(option.WeightValue, options[0].WeightValue);
            Assert.AreEqual(option.QuestionId, question.Id);

            //Old Version
            Assert.AreEqual(option.CreatedAt.ToString(), optionVersions[0].CreatedAt.ToString());
            Assert.AreEqual(1, optionVersions[0].Version);
//            Assert.AreEqual(oldUpdatedAt.ToString(), optionVersions[0].UpdatedAt.ToString());
            Assert.AreEqual(optionVersions[0].WorkflowState, Constants.WorkflowStates.Created);
            Assert.AreEqual(option.Id, optionVersions[0].OptionId);
            Assert.AreEqual(option.Weight, optionVersions[0].Weight);
            Assert.AreEqual(option.OptionsIndex, optionVersions[0].OptionsIndex);
            Assert.AreEqual(option.WeightValue, optionVersions[0].WeightValue);
            Assert.AreEqual(question.Id, optionVersions[0].QuestionId);

            //New Version
            Assert.AreEqual(option.CreatedAt.ToString(), optionVersions[1].CreatedAt.ToString());
            Assert.AreEqual(2, optionVersions[1].Version);
//            Assert.AreEqual(option.UpdatedAt.ToString(), optionVersions[1].UpdatedAt.ToString());
            Assert.AreEqual(optionVersions[1].WorkflowState, Constants.WorkflowStates.Removed);
            Assert.AreEqual(option.Id, optionVersions[1].OptionId);
            Assert.AreEqual(option.Weight, optionVersions[1].Weight);
            Assert.AreEqual(option.OptionsIndex, optionVersions[1].OptionsIndex);
            Assert.AreEqual(option.WeightValue, optionVersions[1].WeightValue);
            Assert.AreEqual(question.Id, optionVersions[1].QuestionId);
        }
        public async Task options_Delete_DoesDelete()
        {
            // Arrange
            #region QuestionSet
            string        name        = Guid.NewGuid().ToString();
            question_sets questionSet = new question_sets
            {
                Name            = name,
                Share           = false,
                HasChild        = false,
                PosiblyDeployed = false
            };
            await questionSet.Create(dbContext).ConfigureAwait(false);

            #endregion

            #region Question
            Random    rnd           = new Random();
            string    type          = Guid.NewGuid().ToString();
            string    questionType  = Guid.NewGuid().ToString();
            string    imagePosition = Guid.NewGuid().ToString();
            string    fontSize      = Guid.NewGuid().ToString();
            questions question      = new questions
            {
                Type                 = type,
                QuestionType         = questionType,
                ImagePosition        = imagePosition,
                FontSize             = fontSize,
                QuestionSetId        = questionSet.Id,
                Maximum              = rnd.Next(1, 255),
                Minimum              = rnd.Next(1, 255),
                RefId                = rnd.Next(1, 255),
                MaxDuration          = rnd.Next(1, 255),
                MinDuration          = rnd.Next(1, 255),
                QuestionIndex        = rnd.Next(1, 255),
                ContinuousQuestionId = rnd.Next(1, 255),
                Prioritised          = false,
                ValidDisplay         = false,
                BackButtonEnabled    = false,
                Image                = false
            };

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

            #endregion

            #region Option

            options option = new options
            {
                WeightValue        = rnd.Next(1, 255),
                QuestionId         = question.Id,
                Weight             = rnd.Next(1, 255),
                OptionsIndex       = rnd.Next(1, 255),
                NextQuestionId     = rnd.Next(1, 255),
                ContinuousOptionId = rnd.Next(1, 255)
            };
            await option.Create(dbContext).ConfigureAwait(false);

            #endregion

            // Act

            await option.Delete(dbContext);

            options         dbOption   = dbContext.options.AsNoTracking().First();
            option_versions dbVersions = dbContext.option_versions.AsNoTracking().First();
            //Assert
            Assert.NotNull(dbOption);
            Assert.NotNull(dbVersions);

            Assert.AreEqual(option.WeightValue, dbOption.WeightValue);
            Assert.AreEqual(option.Weight, dbOption.Weight);
            Assert.AreEqual(option.QuestionId, dbOption.QuestionId);
            Assert.AreEqual(option.OptionsIndex, dbOption.OptionsIndex);
            Assert.AreEqual(option.NextQuestionId, dbOption.NextQuestionId);
            Assert.AreEqual(option.ContinuousOptionId, dbOption.ContinuousOptionId);
            Assert.AreEqual(Constants.WorkflowStates.Removed, dbOption.WorkflowState);
        }