コード例 #1
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldNotChangeCompFieldsIfTheyAreNull()
        {
            UserS.SeedPeshoAndGosho(context);
            var comps    = CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var usedComp = comps[0];

            string initialDescription    = usedComp.Description;
            string initialName           = usedComp.Name;
            string initialTargetLanguage = usedComp.TargetLanguage;
            string initialSourceLanguage = usedComp.SourceLanguage;

            var compSave = new ComparisonSave
            {
                Id             = usedComp.Id,
                Description    = null,
                Name           = null,
                TargetLanguage = null,
                SourceLanguage = null,
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.GoshoUsername);

            action.Invoke();

            usedComp = context.Comparisons.SingleOrDefault(x => x.Id == usedComp.Id);

            usedComp.Description.Should().Be(initialDescription);
            usedComp.Name.Should().Be(initialName);
            usedComp.TargetLanguage.Should().Be(initialTargetLanguage);
            usedComp.SourceLanguage.Should().Be(initialSourceLanguage);
        }
コード例 #2
0
        [Test]///Checked
        public void AppliesDeletedChangeToExistingNotesShouldSoftDeleteThem()
        {
            UserS.SeedPeshoAndGosho(context);
            var video   = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);
            var changes = new string[][]
            {
                new string[] { "1", "Deleted", "Not Used" },
                new string[] { "2", "Deleted", "Not Used" }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername, changes);

            action.Invoke();

            video = context.Videos
                    .Include(x => x.Notes)
                    .SingleOrDefault(x => x.Id == video.Id);

            var note1 = video.Notes.SingleOrDefault(x => x.Id == 1);
            var note2 = video.Notes.SingleOrDefault(x => x.Id == 2);

            note1.IsDeleted.Should().Be(true);
            note2.IsDeleted.Should().Be(true);
        }
コード例 #3
0
        public void CreateNewItemsReturnsTheRightIdsToUpdateThePageEntries()
        {
            UserS.SeedPeshoAndGosho(this.context);
            var video    = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);
            var newNotes = VideoS.GenerateNoteCreateSimpleNested(VideoS.preExistingNote1Id);

            ChangeTrackerOperations.DetachAll(this.context);
            Func <int[][]> function = this.GetPartialSaveFunction(video.Id, UserS.GoshoUsername, newNotes);
            var            result   = function.Invoke();

            ///This means everything is ok
            result[0][0].Should().Be(0);

            var separatedResult = result.Skip(1).ToList();

            var newNote1DbId = context.VideoNotes.Where(x => x.Content == VideoS.Note1Content).SingleOrDefault().Id;
            var newNote2DbId = context.VideoNotes.Where(x => x.Content == VideoS.Note2Content).SingleOrDefault().Id;
            var newNote3DbId = context.VideoNotes.Where(x => x.Content == VideoS.Note3Content).SingleOrDefault().Id;

            var expectedOutcome = new List <int[]>
            {
                new int[] { VideoS.Note1InPageId, newNote1DbId },
                new int[] { VideoS.Note2InPageId, newNote2DbId },
                new int[] { VideoS.Note3InPageId, newNote3DbId },
            };

            for (int i = 0; i < expectedOutcome.Count; i++)
            {
                var pair = expectedOutcome[i];
                separatedResult.Should().Contain(x => x[0] == pair[0] && x[1] == pair[1]);
                var ind = separatedResult.FindIndex(x => x[0] == pair[0] && x[1] == pair[1]);
                separatedResult.RemoveAt(ind);
            }
            separatedResult.Should().HaveCount(0);
        }
コード例 #4
0
        [Test]///Checked
        public void ShoudCreate3nestedNotesStartingAtRootCorrectly()
        {
            UserS.SeedPeshoAndGosho(this.context);
            var video    = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);
            var newNotes = VideoS.GenerateNoteCreateSimpleNested(null);

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername, newNotes);

            action.Invoke();

            video = context.Videos
                    .Include(x => x.Notes)
                    .SingleOrDefault(x => x.Id == video.Id);

            var level1Note = video.Notes.SingleOrDefault(x => x.Content == "NestedLevel1");

            level1Note.Note.Should().BeNull();
            level1Note.ChildNotes.Count.Should().Be(1);

            var level2Note = level1Note.ChildNotes.SingleOrDefault();

            level2Note.Content.Should().Be("NestedLevel2");
            level2Note.ChildNotes.Count.Should().Be(1);

            var level3Note = level2Note.ChildNotes.SingleOrDefault();

            level3Note.Content.Should().Be("NestedLevel3");
            level3Note.ChildNotes.Count.Should().Be(0);

            video.Notes.Count.Should().Be(5);
        }
コード例 #5
0
        [Test]///Checked
        public void AppliesSeekToChangesToExistingNotesCorrectly()
        {
            const int Note1NewSeekTo = 15;
            const int Note2NewSeekTo = 16;

            UserS.SeedPeshoAndGosho(context);
            var video   = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);
            var changes = new string[][]
            {
                new string[] { "1", "SeekTo", Note1NewSeekTo.ToString() },
                new string[] { "2", "SeekTo", Note2NewSeekTo.ToString() }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername, changes);

            action.Invoke();

            video = context.Videos
                    .Include(x => x.Notes)
                    .SingleOrDefault(x => x.Id == video.Id);

            var note1 = video.Notes.SingleOrDefault(x => x.Id == 1);
            var note2 = video.Notes.SingleOrDefault(x => x.Id == 2);

            note1.SeekTo.Should().Be(Note1NewSeekTo);
            note2.SeekTo.Should().Be(Note2NewSeekTo);
        }
コード例 #6
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldChangeCompFieldsIfTheyAreNotNull()
        {
            const string newDescription    = "New Description";
            const string newName           = "NewName";
            const string newTargetLanguage = "New Target Language";
            const string newSourceLanguage = "New Source Language";

            UserS.SeedPeshoAndGosho(context);
            var comps    = CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var usedComp = comps[0];
            var compSave = new ComparisonSave
            {
                Id             = usedComp.Id,
                Description    = newDescription,
                Name           = newName,
                TargetLanguage = newTargetLanguage,
                SourceLanguage = newSourceLanguage,
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.GoshoUsername);

            action.Invoke();

            ///reataching the entity we want to monitor
            usedComp = context.Comparisons.SingleOrDefault(x => x.Id == usedComp.Id);

            usedComp.Description.Should().Be(newDescription);
            usedComp.Name.Should().Be(newName);
            usedComp.TargetLanguage.Should().Be(newTargetLanguage);
            usedComp.SourceLanguage.Should().Be(newSourceLanguage);
        }
コード例 #7
0
        public void ShouldThrowIfVIdeoIsNotFound()
        {
            const int NonExistantVideoId = 12;

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(NonExistantVideoId, UserS.GoshoUsername);

            action.Should().Throw <ItemNotFound>().WithMessage("The video you are working on does not exists in the database");
        }
コード例 #8
0
ファイル: RestTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void CreateThrowsIfDirectoryDoesNotExist()
        {
            const int    NonExistantDirectoryId = 13;
            const string NonExistantUsername    = "******";

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.videoService.Create(NonExistantDirectoryId, NonExistantUsername);

            action.Should().Throw <ItemNotFound>().WithMessage("The Directory you selected for creating the new video notes in, does not exist!");
        }
コード例 #9
0
        public void ShouldThrowIfVIdeoDoesNotBelogToUser()
        {
            UserS.SeedPeshoAndGosho(context);
            var video = VideoS.SeedVideosToUser(context, UserS.GoshoId);

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.PeshoUsername);

            action.Should().Throw <AccessDenied>().WithMessage("The video you are trying to medify does not belong to you!");
        }
コード例 #10
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldThrowIfInvalidUsername()
        {
            UserS.SeedPeshoAndGosho(context);
            var invalidUsername = "******";

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(new ComparisonSave(), invalidUsername);

            action.Should().Throw <UserNotFound>();
        }
コード例 #11
0
        public void IfTheNestingLevelIsGreaterThan4Throw()
        {
            UserS.SeedPeshoAndGosho(this.context);
            var video    = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);
            var newNotes = VideoS.GenerateNoteCreateSimpleNested(VideoS.preExistingNote1Id, 4);

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = this.GetPartialSaveAction(video.Id, UserS.GoshoUsername, newNotes);

            action.Should().Throw <BadRequestError>().WithMessage("The notes you are trying to save are nested deeper the four levels!");
        }
コード例 #12
0
ファイル: RestTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void CreateThrowsIfUserDoesNotExist()
        {
            UserS.SeedPeshoAndGosho(context);

            int          ExistingDirecotryId = UserS.GoshoRootDirId;
            const string NonExistantUsername = "******";

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.videoService.Create(ExistingDirecotryId, NonExistantUsername);

            action.Should().Throw <UserNotFound>();
        }
コード例 #13
0
ファイル: RestTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void CreateThrowsIfDirectoryDoesNotBelongToUser()
        {
            UserS.SeedPeshoAndGosho(context);

            int    ExistingDirecotryId = UserS.GoshoRootDirId;
            string ExistingUsername    = UserS.PeshoUsername;

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.videoService.Create(ExistingDirecotryId, ExistingUsername);

            action.Should().Throw <AccessDenied>().WithMessage("The directory you are trying to create a video on does note belong to you!");
        }
コード例 #14
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldThrowIfCompDoesNotBelongToUser()
        {
            UserS.SeedPeshoAndGosho(context);
            var comps    = CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var compSave = new ComparisonSave
            {
                Id = comps[0].Id,
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.PeshoUsername);

            action.Should().Throw <AccessDenied>().WithMessage("The comparison does not belong to you!");
        }
コード例 #15
0
        public void ShouldNotChangeVideoFieldsIfTheyAreAllNull()
        {
            UserS.SeedPeshoAndGosho(context);
            var video = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername);

            action.Invoke();

            video.SeekTo.Should().Be(VideoS.DefaultVideoSeekTo);
            video.Name.Should().Be(VideoS.DefaultVideoName);
            video.Description.Should().Be(VideoS.DefaultVideoDesctiption);
            video.Url.Should().Be(VideoS.DefaultVideoUrl);
        }
コード例 #16
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldThrowIfNonexistantComparison()
        {
            UserS.SeedPeshoAndGosho(context);
            CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var invalidCompId = 42;
            var compSave      = new ComparisonSave
            {
                Id = invalidCompId,
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.GoshoUsername);

            action.Should().Throw <ItemNotFound>().WithMessage("The comparison you are trying to modify does not exist!");
        }
コード例 #17
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldThrow_IfSomeOfToBeAlteredItems_HaveIdsNotInTheComparisonsItems()
        {
            UserS.SeedPeshoAndGosho(context);
            var comps    = CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var usedComp = comps[0];
            var items    = CompS.SeedThreeItemsToComp(this.context, usedComp);

            var compSave = new ComparisonSave
            {
                Id             = usedComp.Id,
                Description    = null,
                Name           = null,
                TargetLanguage = null,
                SourceLanguage = null,
                AlteredItems   = new HashSet <ComparisonItemChange>
                {
                    new ComparisonItemChange
                    {
                        Id              = 1,
                        NewValue        = "new test value",
                        PropertyChanged = "Comment"
                    },
                    new ComparisonItemChange
                    {
                        Id              = 2,
                        NewValue        = "new test value",
                        PropertyChanged = "Order"
                    },
                    new ComparisonItemChange
                    {
                        Id              = 3,
                        NewValue        = "new test value",
                        PropertyChanged = "Source"
                    },
                    new ComparisonItemChange
                    {
                        Id              = 4,
                        NewValue        = "new test value",
                        PropertyChanged = "Target"
                    }
                }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.GoshoUsername);

            action.Should().Throw <AccessDenied>().WithMessage("The comparison items you are trying to alter does not belong the comparison you are altering!");
        }
コード例 #18
0
        public void ShouldThrowIfIdsToChangeDoNotBelongToVideo()
        {
            UserS.SeedPeshoAndGosho(context);
            var video   = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);
            var changes = new string[][]
            {
                new string[] { "1", "some prop", "some val" },
                new string[] { "2", "some prop", "some val" },
                ///The existing values are 1 and 2, 3 is not in that video;
                new string[] { "3", "some prop", "some val" }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername, changes);

            action.Should().Throw <AccessDenied>().WithMessage("The video notes you are trying to modify does not belong the the current video");
        }
コード例 #19
0
        public void PartialSaveDoesNotRegisterModificationOfVideoIfItIsNotFinalSave()
        {
            UserS.SeedPeshoAndGosho(this.context);
            var video = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);

            var videoLastModifiedOn    = video.LastModifiedOn;
            var videoMidificationCount = video.TimesModified;


            ChangeTrackerOperations.DetachAll(this.context);
            Action action = this.GetPartialSaveAction(video.Id, UserS.GoshoUsername, false);

            action.Invoke();

            var newVideoLastModifiedOn    = video.LastModifiedOn;
            var newVideoMidificationCount = video.TimesModified;

            newVideoLastModifiedOn.Value.Should().Be(videoLastModifiedOn.Value);
            newVideoMidificationCount.Should().Be(videoMidificationCount);
        }
コード例 #20
0
ファイル: RestTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void CreateCreatsVideo()
        {
            ///Also seeds their root directories
            UserS.SeedPeshoAndGosho(context);

            int    ExistingDirecotryId = UserS.GoshoRootDirId;
            string ExistingUsername    = UserS.GoshoUsername;

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.videoService.Create(ExistingDirecotryId, ExistingUsername);

            action.Invoke();

            var video = context.Directories
                        .SingleOrDefault(x => x.Id == ExistingDirecotryId)
                        .Videos
                        .SingleOrDefault();

            video.DirectoryId.Should().Be(ExistingDirecotryId);
            video.UserId.Should().Be(UserS.GoshoId);
        }
コード例 #21
0
        [Test]///Checked
        public void RegisterModificationWhenExistingItemsAreChanged()
        {
            const Formatting Note1NewFormatting = Formatting.SQL;
            const Formatting Note2NewFormatting = Formatting.None;

            UserS.SeedPeshoAndGosho(context);
            var video = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);

            var note1 = video.Notes.SingleOrDefault(x => x.Id == VideoS.preExistingNote1Id);
            var note2 = video.Notes.SingleOrDefault(x => x.Id == VideoS.preExistingNote2Id);
            var intialModifedOnNote1      = note1.LastModifiedOn;
            var intialModifedOnNote2      = note2.LastModifiedOn;
            var initialTimesModifiedNote1 = note1.TimesModified;
            var initialTimesModifiedNote2 = note2.TimesModified;

            var changes = new string[][]
            {
                new string[] { VideoS.preExistingNote1Id.ToString(), "Formatting", ((int)Note1NewFormatting).ToString() },
                new string[] { VideoS.preExistingNote2Id.ToString(), "Formatting", ((int)Note2NewFormatting).ToString() }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername, changes);

            action.Invoke();

            video = context.Videos
                    .Include(x => x.Notes)
                    .SingleOrDefault(x => x.Id == video.Id);

            note1 = video.Notes.SingleOrDefault(x => x.Id == VideoS.preExistingNote1Id);
            note2 = video.Notes.SingleOrDefault(x => x.Id == VideoS.preExistingNote2Id);

            intialModifedOnNote1.Value.Should().BeBefore(note1.LastModifiedOn.Value);
            intialModifedOnNote2.Value.Should().BeBefore(note2.LastModifiedOn.Value);
            initialTimesModifiedNote1.Should().Be(note1.TimesModified - 1);
            initialTimesModifiedNote2.Should().Be(note2.TimesModified - 1);
        }
コード例 #22
0
        public void ShouldChangeVideoFieldsIfTheyAreProvided()
        {
            const int    NewSeekTo      = 20;
            const string NewName        = "NewName";
            const string NewDescription = "NewDescription";
            const string NewUrl         = "NewUrl";

            UserS.SeedPeshoAndGosho(context);
            var video = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = GetPartialSaveAction(video.Id, UserS.GoshoUsername, NewSeekTo, NewName, NewDescription, NewUrl);

            action.Invoke();

            video = context.Videos
                    .SingleOrDefault(x => x.Id == video.Id);

            video.SeekTo.Should().Be(NewSeekTo);
            video.Name.Should().Be(NewName);
            video.Description.Should().Be(NewDescription);
            video.Url.Should().Be(NewUrl);
        }
コード例 #23
0
        [Test]///Cheked
        public void PartialSaveRegisterModificationOfVideoIfItIsFinalSave()
        {
            UserS.SeedPeshoAndGosho(this.context);
            var video = VideoS.SeedVideosToUserWithNotes(context, UserS.GoshoId);

            var videoLastModifiedOn    = video.LastModifiedOn;
            var videoMidificationCount = video.TimesModified;


            ChangeTrackerOperations.DetachAll(this.context);
            Action action = this.GetPartialSaveAction(video.Id, UserS.GoshoUsername, true);

            action.Invoke();

            video = context.Videos
                    .Include(x => x.Notes)
                    .SingleOrDefault(x => x.Id == video.Id);

            var newVideoLastModifiedOn    = video.LastModifiedOn;
            var newVideoMidificationCount = video.TimesModified;

            newVideoLastModifiedOn.Value.Should().NotBe(videoLastModifiedOn.Value);
            newVideoMidificationCount.Should().Be(videoMidificationCount + 1);
        }
コード例 #24
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldSaveNewItems()
        {
            const string item1Comment = "Comment1";
            const int    item1Order   = 4;
            const string item1Source  = "Source1";
            const string item1Target  = "Target1";

            const string item2Comment = "Comment2";
            const int    item2Order   = 3;
            const string item2Source  = "Source2";
            const string item2Target  = "Target2";

            UserS.SeedPeshoAndGosho(context);
            var comps    = CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var usedComp = comps[0];

            var compSave = new ComparisonSave
            {
                Id             = usedComp.Id,
                Description    = null,
                Name           = null,
                TargetLanguage = null,
                SourceLanguage = null,
                NewItems       = new HashSet <ComparisonItemEdit>
                {
                    new ComparisonItemEdit
                    {
                        Id      = 33,
                        Comment = item1Comment,
                        Order   = item1Order,
                        Source  = item1Source,
                        Target  = item1Target,
                    },
                    new ComparisonItemEdit
                    {
                        Id      = 44,
                        Comment = item2Comment,
                        Order   = item2Order,
                        Source  = item2Source,
                        Target  = item2Target,
                    },
                }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.GoshoUsername);

            ///The mapping should set preSaved db items ids to 0; It Does
            action.Invoke();

            ///The items are actually already tracked from the execution
            ///of the action but I am including them for consistancy
            usedComp = context.Comparisons
                       .Include(x => x.Items)
                       .SingleOrDefault(x => x.Id == usedComp.Id);

            var newCompItems = usedComp.Items;

            ///TODO: find better way to identify the items, maybe seed them with id
            var item1 = newCompItems.SingleOrDefault(x => x.Comment == item1Comment);

            item1.Should().NotBe(null);
            item1.Source.Should().Be(item1Source);
            item1.Target.Should().Be(item1Target);
            item1.Order.Should().Be(item1Order);

            var item2 = newCompItems.SingleOrDefault(x => x.Comment == item2Comment);

            item2.Should().NotBe(null);
            item2.Source.Should().Be(item2Source);
            item2.Target.Should().Be(item2Target);
            item2.Order.Should().Be(item2Order);
        }
コード例 #25
0
ファイル: SaveTests.cs プロジェクト: Nikismyname/Momento
        [Test]///Checked
        public void SaveShouldAlterExistingItems_ForAValidRequest()
        {
            const string item1NewSource  = "itemOneNewSource";
            const string item1NewTarget  = "itemOneNewTarget";
            const string item1NewComment = "itemOneNewComment";
            const int    item1NewOrder   = 4;

            const string item2NewSource  = "itemTwoNewSource";
            const string item2NewTarget  = "itemTwoNewTarget";
            const string item2NewComment = "itemTwoNewComment";
            const int    item2NewOrder   = 3;


            UserS.SeedPeshoAndGosho(context);
            var comps    = CompS.SeedTwoCompsToUser(context, UserS.GoshoId);
            var usedComp = comps[0];
            var items    = CompS.SeedThreeItemsToComp(this.context, usedComp);

            var compSave = new ComparisonSave
            {
                Id             = usedComp.Id,
                Description    = null,
                Name           = null,
                TargetLanguage = null,
                SourceLanguage = null,
                AlteredItems   = new HashSet <ComparisonItemChange>
                {
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item1Id,
                        NewValue        = item1NewComment,
                        PropertyChanged = "Comment"
                    },
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item1Id,
                        NewValue        = item1NewOrder.ToString(),
                        PropertyChanged = "Order"
                    },
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item1Id,
                        NewValue        = item1NewSource,
                        PropertyChanged = "Source"
                    },
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item1Id,
                        NewValue        = item1NewTarget,
                        PropertyChanged = "Target"
                    },


                    new ComparisonItemChange
                    {
                        Id              = CompS.Item2Id,
                        NewValue        = item2NewComment,
                        PropertyChanged = "Comment"
                    },
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item2Id,
                        NewValue        = item2NewOrder.ToString(),
                        PropertyChanged = "Order"
                    },
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item2Id,
                        NewValue        = item2NewSource,
                        PropertyChanged = "Source"
                    },
                    new ComparisonItemChange
                    {
                        Id              = CompS.Item2Id,
                        NewValue        = item2NewTarget,
                        PropertyChanged = "Target"
                    },
                }
            };

            ChangeTrackerOperations.DetachAll(this.context);
            Action action = () => this.comparisonService.Save(compSave, UserS.GoshoUsername);

            action.Invoke();

            var item1 = context.ComparisonItems.SingleOrDefault(x => x.Id == CompS.Item1Id);
            var item2 = context.ComparisonItems.SingleOrDefault(x => x.Id == CompS.Item2Id);

            item1.Comment.Should().Be(item1NewComment);
            item1.Order.Should().Be(item1NewOrder);
            item1.Source.Should().Be(item1NewSource);
            item1.Target.Should().Be(item1NewTarget);

            item2.Comment.Should().Be(item2NewComment);
            item2.Order.Should().Be(item2NewOrder);
            item2.Source.Should().Be(item2NewSource);
            item2.Target.Should().Be(item2NewTarget);
        }