public void UniqueSaver_WhenNotUniqueSave_ShouldThrowException()
        {
            ////Arrange
            var someEntity = new Area
            {
                LayoutId    = 1,
                Description = "First area of first layout",
                CoordX      = 3,
                CoordY      = 4,
            };

            var saverMock = new Mock <ISave <Area> >();

            var uniqueSaver = new EfUniqueSeparateSaver <Area>(
                saverMock.Object,
                new EfContext(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString),
                new[] { "Description" }, ////unique by Description field
                "LayoutId");             ////in layout

            ////Act
            void TestAction()
            {
                uniqueSaver.Save(someEntity);
            }

            ////Assert
            Assert.Throws <NotUniqueException>(TestAction);
        }
        public void UniqueSaver_WhenUniqueEntitySave_ShouldPerformSave()
        {
            ////Arrange
            var modelEntity = new Area
            {
                LayoutId    = 2,
                Description = "Second area of second layout",
                CoordX      = 3,
                CoordY      = 4,
            };

            var saverMock = new Mock <ISave <Area> >();

            saverMock.Setup(s => s.Save(modelEntity)).Returns(modelEntity);

            var uniqueSaver = new EfUniqueSeparateSaver <Area>(
                saverMock.Object,
                new EfContext(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString),
                new[] { "Description" }, ////unique by Description field
                "LayoutId");             ////in layout

            ////Act
            var result = uniqueSaver.Save(modelEntity);

            ////Assert
            result.Should().BeEquivalentTo(modelEntity);
        }