Ejemplo n.º 1
0
        public void ShouldNotRemoveStringFromDbSetWhenMultipleInstancesExist()
        {
            const string stringToDelete = "foot";

            FakeStringRepository.FakeSet.Collection = new List <string> {
                stringToDelete, stringToDelete, "shoulder"
            };

            FakeStringRepository.DeleteSingle(s => s == stringToDelete);

            Assert.IsFalse(FakeStringRepository.FakeSet.RemoveWasCalled, "Remove should not have been called.");
        }
Ejemplo n.º 2
0
        public void ShouldRemoveStringFromDbSetWhenItIsTheOnlyInstanceInDbSet()
        {
            const string stringToDelete = "foot";

            FakeStringRepository.FakeSet.Collection = new List <string> {
                stringToDelete, "hand"
            };

            FakeStringRepository.DeleteSingle(s => s == stringToDelete);

            Assert.IsTrue(FakeStringRepository.FakeSet.RemoveWasCalled, "Remove should have been called.");
        }
Ejemplo n.º 3
0
        public void ShouldNotRemoveStringFromDbSetWhenItDoesNotExist()
        {
            const string stringToDelete = "foot";

            FakeStringRepository.FakeSet.Collection = new List <string> {
                "hand", "shoulder", "arm"
            };

            FakeStringRepository.DeleteSingle(s => s == stringToDelete);

            Assert.IsFalse(FakeStringRepository.FakeSet.RemoveWasCalled, "Remove should not have been called.");
        }