コード例 #1
0
        public void CreateCommand_Valid_ExpectInstantiated()
        {
            MyAbstractCommandFactory factory = GivenAFactoryWithMyCommand();
            // when we request to create an instance of that command
            var command = factory.CreateCommand <IMyCommand>(credentials);

            //then we expect it to be there
            Assert.IsNotNull(command, "should be created, as a valid interface is specified");
            Assert.IsInstanceOfType(command, typeof(MyCommand));
        }
コード例 #2
0
        public void CreateCommand_InValid_ExpectException()
        {
            MyAbstractCommandFactory factory = GivenAFactoryWithMyCommand();

            try
            {
                var command = factory.CreateCommand <ISillyCommand>(credentials);
            }
            catch (ArgumentException)
            {
                return;
            }
            Assert.Fail("should not be created, as an invalid interface is specified");
        }