public void Equality_Default()
        {
            var a = new RelativeEditLocation();
            var b = new RelativeEditLocation();

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void ToStringImplementation()
        {
            var sut = new RelativeEditLocation {
                Location = 2, Size = 3
            };

            Assert.AreEqual("RelativeEditLocation(2/3)", sut.ToString());
        }
        public void HasLocation()
        {
            var actual = new RelativeEditLocation();

            Assert.False(actual.HasEditLocation);
            actual.Location = 1;
            Assert.True(actual.HasEditLocation);
        }
        public void DefaultValues()
        {
            var actual = new RelativeEditLocation();

            Assert.AreEqual(0, actual.Size);
            Assert.AreEqual(0, actual.Location);
            Assert.AreNotEqual(0, actual.GetHashCode());
            Assert.AreNotEqual(1, actual.GetHashCode());
        }
        private static RelativeEditLocation CreateRandomLocation(Random rng)
        {
            var size = (rng.Next() % 28) + 2;
            var loc  = (rng.Next() % (size - 1)) + 1;
            var rnd  = new RelativeEditLocation {
                Location = loc, Size = size
            };

            return(rnd);
        }
        private void AssertLocation(int expectedLocation, int expectedSize)
        {
            var expected = new RelativeEditLocation
            {
                Location = expectedLocation,
                Size     = expectedSize
            };

            Assert.AreEqual(expected, _actual);
        }
        public void Equality_DifferentLocation()
        {
            var a = new RelativeEditLocation
            {
                Location = 1
            };
            var b = new RelativeEditLocation();

            Assert.AreNotEqual(a, b);
            Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
        }
        public void SettingValues()
        {
            var actual = new RelativeEditLocation
            {
                Location = 1,
                Size     = 2
            };

            Assert.AreEqual(1, actual.Location);
            Assert.AreEqual(2, actual.Size);
        }
        private void Analyze(params IStatement[] stmts)
        {
            var sst = new SST
            {
                Methods =
                {
                    new MethodDeclaration
                    {
                        Body = Lists.NewListFrom(stmts)
                    }
                }
            };

            _actual = _sut.Analyze(sst);
        }
        public void Equality_ReallyTheSame()
        {
            var a = new RelativeEditLocation
            {
                Location = 1,
                Size     = 2
            };
            var b = new RelativeEditLocation
            {
                Location = 1,
                Size     = 2
            };

            Assert.AreEqual(a, b);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
        private void AssertNoLocation()
        {
            var expected = new RelativeEditLocation();

            Assert.AreEqual(expected, _actual);
        }
        public void IntegrationTest1()
        {
            var sst = new SST
            {
                Methods =
                {
                    new MethodDeclaration
                    {
                        Body =
                        {
                            new VariableDeclaration
                            {
                                Reference = new VariableReference{
                                    Identifier = "coreName"
                                },
                                Type = Names.Type("KaVE.Commons.Model.ObjectUsage.CoReName, KaVE.Commons, 1.0.0.0")
                            },
                            new Assignment
                            {
                                Reference = new VariableReference{
                                    Identifier = "coreName"
                                },
                                Expression = new UnknownExpression()
                            },
                            new IfElseBlock
                            {
                                Condition = new UnknownExpression(),
                                Then      =
                                {
                                    new ExpressionStatement
                                    {
                                        Expression = new InvocationExpression
                                        {
                                            Reference = new VariableReference{
                                                Identifier = "writer"
                                            },
                                            MethodName =
                                                Names.Method(
                                                    "[System.Void, mscorlib, 4.0.0.0] [Newtonsoft.Json.JsonWriter, Newtonsoft.Json, 6.0.0.0].WriteValue([System.String, mscorlib, 4.0.0.0] value)"),
                                            Parameters =
                                            {
                                                new ReferenceExpression
                                                {
                                                    Reference = new VariableReference{
                                                        Identifier = "Name"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            new VariableDeclaration
                            {
                                Reference = new VariableReference{
                                    Identifier = "callSite"
                                },
                                Type = Names.Type("KaVE.Commons.Model.ObjectUsage.CallSite, KaVE.Commons, 1.0.0.0")
                            },
                            new Assignment
                            {
                                Reference = new VariableReference{
                                    Identifier = "callSite"
                                },
                                Expression = new UnknownExpression()
                            },
                            new ExpressionStatement
                            {
                                Expression = new CompletionExpression{
                                    Token = "i"
                                }
                            }
                        }
                    }
                }
            };

            var actual   = _sut.Analyze(sst);
            var expected = new RelativeEditLocation {
                Size = 7, Location = 7
            };

            Assert.AreEqual(expected, actual);
        }