Exemple #1
0
        public void PutLicenseWithoutIdTest()
        {
            var mockDependency = new Mock <ILicenseRepository>();
            var model          = new LicenseModel()
            {
                ClientName = "test"
            };

            mockDependency.Setup(x => x.EditLicense(1, model)).Returns(() => true);

            // Act
            var controller = new LicenseController()
            {
                AppRepo = mockDependency.Object
            };

            // Assert
            var res = controller.Put(model);

            if (res?.Data != null)
            {
                Assert.AreEqual("Error: Id license <= 0", res.Description);
                Assert.AreEqual(false, res.Data);
            }
            else
            {
                Assert.AreEqual(1, 2);
            }
        }
Exemple #2
0
        public void PutLicense()
        {
            var mockDependency = new Mock <ILicenseRepository>();
            var model          = new LicenseModel()
            {
                ClientName    = "test",
                Id            = 5,
                IdApplication = 4
            };

            mockDependency.Setup(x => x.EditLicense(5, model)).Returns(() => true);

            // Act
            var controller = new LicenseController()
            {
                AppRepo = mockDependency.Object
            };

            // Assert
            var res = controller.Put(model);

            if (res?.Data != null)
            {
                Assert.AreEqual("OK", res.Description);
                Assert.AreEqual(true, res.Data);
            }
            else
            {
                Assert.AreEqual(1, 2);
            }
        }