public void InsertDogTrainer(DogTrainer dogTrainer)
        {
            var dog     = dogTrainer.FetchObject1(ChangeSet, DbContext);
            var trainer = dogTrainer.FetchObject2(ChangeSet, DbContext);

            dog.Trainers.Add(trainer);
            DbContext.ChangeTracker.DetectChanges();
        }
        public void DeleteDogTrainer(DogTrainer dogTrainer)
        {
            var dog     = dogTrainer.FetchObject1(ChangeSet, DbContext);
            var trainer = dogTrainer.FetchObject2(ChangeSet, DbContext);

            DbContext.LoadM2M <Dog, Trainer, DogTrainer>(dog, trainer);

            dog.Trainers.Remove(trainer);
            DbContext.ChangeTracker.DetectChanges();
        }
Exemplo n.º 3
0
        public void Trainer_WithDog_Barks()
        {
            // Arrange
            var dog        = new Dog();
            var dogTrainer = new DogTrainer(dog);

            // Act
            var whatDoesADogSay = dogTrainer.MakePetSpeak();

            // Assert
            Assert.IsTrue(whatDoesADogSay == "WOOF, WOOF");
        }
Exemplo n.º 4
0
        public void Trainer_WithDog_Barks()
        {
            // Arrange
            _dog.Setup(x => x.Speak()).Returns("Hello, is it me you're looking for?");
            var dogTrainer = new DogTrainer(_dog.Object);

            // Act
            var whatDoesADogSay = dogTrainer.MakePetSpeak();

            // Assert
            Assert.IsTrue(whatDoesADogSay == "Hello, is it me you're looking for?");
        }