コード例 #1
0
        public void CompanyRename_Successful()
        {
            const int    companyId      = 2;
            const string newCompanyName = "Second Changed";

            // 1. Pre-checks
            int count = StaticData.Companies.Count();

            Assert.IsFalse(StaticData.Companies.Any(i => i.Name == newCompanyName), Messages.Settings.ShouldNotExist);

            // 2. Perform the insert
            var result = controller.CompanyRename(companyId, newCompanyName);

            Assert.IsTrue((bool)result.Data, Messages.Settings.ShouldBeTrueWhenSuccess);

            // 3. Ensure changes are done
            Assert.AreEqual(StaticData.Companies.Count(), count, Messages.Settings.ShouldRemainSameAmount);
            Assert.AreEqual(StaticData.Companies.First(i => i.Name == newCompanyName).Name, newCompanyName, Messages.Settings.ShouldExist);
        }