コード例 #1
0
        public void AddDeltaGood()
        {
            IDBManager fakeDatabase = new FakeDBManager();

            fakeDatabase.AddDelta(delta);
            Assert.AreEqual(true, fakeDatabase.DeltaExists(delta.FileId));
        }
コード例 #2
0
        public void DeltaExistsGood(string id)
        {
            IDBManager fakeDatabase = new FakeDBManager();

            fakeDatabase.AddDelta(delta);
            Assert.AreEqual(true, fakeDatabase.DeltaExists(id));
        }
コード例 #3
0
        public void AddDeltaBadAlreadyCreated(string id, string content, string linerange)
        {
            Mock <Delta> deltaDouble2 = new Mock <Delta>();

            deltaDouble2.Setup(delta => delta.FileId).Returns(id);
            deltaDouble2.Setup(delta => delta.Content).Returns(content);
            deltaDouble2.Setup(delta => delta.LineRange).Returns(linerange);

            delta = deltaDouble2.Object;

            IDBManager fakeDatabase = new FakeDBManager();

            fakeDatabase.AddDelta(delta);

            Mock <Delta> deltaDouble3 = new Mock <Delta>();

            deltaDouble3.Setup(delta => delta.FileId).Returns(id);
            deltaDouble3.Setup(delta => delta.Content).Returns(content);
            deltaDouble3.Setup(delta => delta.LineRange).Returns(linerange);

            Assert.AreEqual(false, fakeDatabase.AddDelta(delta));
        }
コード例 #4
0
        public void UpdateDeltaGood(string id, string content, string linerange)
        {
            Mock <Delta> deltaDouble2 = new Mock <Delta>();

            deltaDouble2.Setup(delta2 => delta2.FileId).Returns(id);
            deltaDouble2.Setup(delta2 => delta2.Content).Returns(content);
            deltaDouble2.Setup(delta2 => delta2.LineRange).Returns(linerange);

            delta2 = deltaDouble2.Object;
            FakeDBManager fakeDatabase = new FakeDBManager();

            fakeDatabase.AddDelta(delta);

            fakeDatabase.UpdateDelta(delta2);
            Assert.AreEqual(fakeDatabase.GetDelta(delta.FileId).Content, delta2.Content);
            Assert.AreEqual(fakeDatabase.GetDelta(delta.FileId).LineRange, delta2.LineRange);
        }
コード例 #5
0
        public void AddDeltaBadExceptionLength(string id, string content, string linerange)
        {
            Mock <Delta> deltaDouble2 = new Mock <Delta>();

            deltaDouble2.Setup(delta => delta.FileId).Returns(id);
            deltaDouble2.Setup(delta => delta.Content).Returns(content);
            deltaDouble2.Setup(delta => delta.LineRange).Returns(linerange);

            delta = deltaDouble2.Object;

            IDBManager fakeDatabase = new FakeDBManager();

            Assert.Throws <ArgumentException>(() =>
            {
                fakeDatabase.AddDelta(delta);
            }
                                              );
        }