Example #1
0
        public void Fail_Test_If_Saving_Notification_In_BusinessLayer()
        {
            Publisher tester = new Publisher {
                Notification = "Hello"
            };
            Mock <IPublisher> db = new Mock <IPublisher>();

            db.Setup(x => x.Save_Notification("3", new Publisher()
            {
                Notification = "Hello"
            })).Returns(tester);
            PublisherManager businessManager = new PublisherManager(db.Object);
            var target = businessManager.Save_Notification("2", new Publisher()
            {
                Notification = "Hi"
            });

            Assert.AreNotEqual(tester.Notification, target.Notification);
        }
Example #2
0
        public void Test_If_Saving_Notification_In_BusinessLayer()
        {
            Publisher tester = new Publisher {
                Notification = "Hi"
            };
            Mock <IPublisher> db = new Mock <IPublisher>();

            db.Setup(x => x.Save_Notification("3", new Publisher()
            {
                Notification = "Hi"
            })).Returns(tester);
            PublisherManager businessManager = new PublisherManager(db.Object);
            var target = businessManager.Save_Notification("3", new Publisher()
            {
                Notification = "Hi"
            });

            Assert.IsNotNull(target);
            Assert.AreEqual(tester.Notification, target.Notification);
            Assert.AreEqual(tester._id, target._id);
            Assert.IsInstanceOfType(new Publisher(), target.GetType());
        }