public static void CheckThatInnovatorServerExceptionThrownWhenContextItemIsEmpty()
        {
            const string expectedExceptionMessage = "login_name is not defined";

            TestedMethod.BusinessLogic businessLogic = new TestedMethod.BusinessLogic(fakeDataAccessLayer);
            Innovator innovator = ItemHelper.CreateInnovator();

            Item contextItem = innovator.newItem();
            InnovatorServerException exception = Assert.Throws <InnovatorServerException>(() => businessLogic.Run(contextItem));

            Assert.AreEqual(expectedExceptionMessage, exception.Message);

            string amlOfContextItem =
                @"<AML>
					<Item type='User'>
						<login_name></login_name>
					</Item>
				</AML>"                ;

            contextItem.loadAML(amlOfContextItem);
            exception = Assert.Throws <InnovatorServerException>(() => businessLogic.Run(contextItem));
            Assert.AreEqual(expectedExceptionMessage, exception.Message);
        }
        public void CheckThatMethodReturnsOriginalErrorFromServer()
        {
            const string loginName = "sample_user";

            TestedMethod.BusinessLogic businessLogic = new TestedMethod.BusinessLogic(fakeDataAccessLayer);

            fakeDataAccessLayer.ApplyItem(Arg.Is <Item>(item => item.getType() == "User" && item.getProperty("login_name") == loginName))
            .Returns(@params =>
            {
                Item errorItem = innovator.newItem();
                errorItem.loadAML(faultString);
                return(errorItem);
            });

            Item contextItem = innovator.newItem();

            contextItem.setType("User");
            contextItem.setProperty("login_name", loginName);

            Item result = businessLogic.Run(contextItem);

            Assert.IsTrue(result.isError());
            Assert.AreEqual(errorMessage, result.getErrorString());
        }