Exemplo n.º 1
0
        public void ShouldUpdateCompany()
        {
            var proxy = new CompanyProxy();

            var company        = GetTestCompany();
            var insertResponse = proxy.InsertCompany(company);

            Assert.IsTrue(insertResponse.IsSuccessfull);
            Assert.AreEqual(HttpStatusCode.OK, insertResponse.StatusCode);
            Assert.Greater(insertResponse.DataObject.InsertedCompanyId, 0);

            var insertedCompany = proxy.GetCompany(insertResponse.DataObject.InsertedCompanyId).DataObject;

            insertedCompany.LongDescription = "Modified company";
            insertedCompany.Abn             = "123456789";
            insertedCompany.CompanyEmail    = "updated@[email protected]";
            insertedCompany.TradingName     = "Updated Trading Name";
            insertedCompany.Name            = "Updated Name";
            insertedCompany.Website         = "http://updated.com";

            var updateResponse = proxy.UpdateCompany(insertedCompany, insertResponse.DataObject.InsertedCompanyId);

            Assert.IsTrue(updateResponse.IsSuccessfull);
            Assert.AreEqual(insertResponse.DataObject.InsertedCompanyId, updateResponse.DataObject.UpdatedCompanyId);

            var updatedCompany = proxy.GetCompany(updateResponse.DataObject.UpdatedCompanyId).DataObject;

            Assert.AreEqual(updatedCompany.Abn, insertedCompany.Abn, "Incorrect ABN");
            Assert.AreEqual(updatedCompany.CompanyEmail, insertedCompany.CompanyEmail, "Incorrect Company email");
            Assert.AreEqual(updatedCompany.LongDescription, insertedCompany.LongDescription, "Incorrect company description");
            Assert.AreEqual(updatedCompany.TradingName, insertedCompany.TradingName, "Incorrect company trading name");
            Assert.AreEqual(updatedCompany.Website, insertedCompany.Website, "Incorrect company website");
            Assert.IsNotNullOrEmpty(updatedCompany.LastUpdatedId, "Company LastUpdatedId not returned");
            Assert.IsNotNull(updatedCompany.CreatedDateUtc, "Company CreatedDateUtc not returned");
            Assert.IsNotNull(updatedCompany.LastModifiedDateUtc, "Company LastModifiedDateUtc not returned");
            Assert.IsNotNull(updatedCompany.LastModifiedByUserId, "Company LastModifiedByUserId not returned");
        }
Exemplo n.º 2
0
        public void ShouldUpdateCompany()
        {
            var proxy = new CompanyProxy();

            var company        = GetTestCompany();
            var insertResponse = proxy.InsertCompany(company);

            Assert.True(insertResponse.IsSuccessfull);
            Assert.Equal(insertResponse.StatusCode, HttpStatusCode.OK);
            Assert.True(insertResponse.DataObject.InsertedCompanyId > 0);

            var insertedCompany = proxy.GetCompany(insertResponse.DataObject.InsertedCompanyId).DataObject;

            insertedCompany.LongDescription = "Modified company";
            insertedCompany.Abn             = "123456789";
            insertedCompany.CompanyEmail    = "updated@[email protected]";
            insertedCompany.TradingName     = "Updated Trading Name";
            insertedCompany.Name            = "Updated Name";
            insertedCompany.Website         = "http://updated.com";

            var updateResponse = proxy.UpdateCompany(insertedCompany, insertResponse.DataObject.InsertedCompanyId);

            Assert.True(updateResponse.IsSuccessfull);
            Assert.Equal(updateResponse.DataObject.UpdatedCompanyId, insertResponse.DataObject.InsertedCompanyId);

            var updatedCompany = proxy.GetCompany(updateResponse.DataObject.UpdatedCompanyId).DataObject;

            Assert.Equal(insertedCompany.Abn, updatedCompany.Abn);
            Assert.Equal(insertedCompany.CompanyEmail, updatedCompany.CompanyEmail);
            Assert.Equal(insertedCompany.LongDescription, updatedCompany.LongDescription);
            Assert.Equal(insertedCompany.TradingName, updatedCompany.TradingName);
            Assert.Equal(insertedCompany.Website, updatedCompany.Website);
            Assert.True(!string.IsNullOrEmpty(updatedCompany.LastUpdatedId), "Company LastUpdatedId not returned");
            Assert.NotNull(updatedCompany.CreatedDateUtc);
            Assert.NotNull(updatedCompany.LastModifiedDateUtc);
            Assert.NotNull(updatedCompany.LastModifiedByUserId);
        }