Beispiel #1
0
            public void VerboseArgument()
            {
                var subCommand = new SetBlob();
                var arguments  = subCommand.Definition().arguments;

                Assert.NotNull(arguments.Select(a => a.name == SharedAzmiArguments.verbose.name));
            }
Beispiel #2
0
            public void FailsWithNonExistingProperty()
            {
                var obj        = new { nonExistingProperty = 1 };
                var subCommand = new SetBlob();

                // it throws exception
                var actualExc = Assert.Throws <AzmiException>(() =>
                                                              subCommand.Execute(obj)
                                                              );

                Assert.Equal(_failMsg, actualExc.Message);
            }
Beispiel #3
0
            public void ExecutedWithSuccess()
            {
                // mock with success
                var blobSubstitute = Substitute.For <IBlobClient>();

                blobSubstitute.Upload(_path, _force).Returns(_bci);
                var subCommand = new SetBlob();

                var retValue = subCommand.Execute(_path, _url, _identity, _force, blobSubstitute);

                Assert.Equal("Success", retValue);
            }
Beispiel #4
0
            public void ExecutedWithFailure_NoIdentity()
            {
                // mock with exception and call with no identity
                var blobSubstitute = Substitute.For <IBlobClient>();

                blobSubstitute.Upload(_path, _force).Throws(_exception);
                var subCommand = new SetBlob();

                // it returns Azmi exception and testing one as inner
                var actualExc = Assert.Throws <AzmiException>(
                    () => subCommand.Execute(_path, _url, null, _force, blobSubstitute)
                    );

                Assert.Equal(_exception.Message, actualExc.InnerException.Message);
            }
Beispiel #5
0
            public void ExecutedWithFailure_WithIdentity()
            {
                // mock with exception and call with identity
                var blobSubstitute = Substitute.For <IBlobClient>();

                blobSubstitute.Upload(_path, _force).Throws(_exception);
                var subCommand = new SetBlob();

                // it returns testing exception
                var actualExc = Assert.Throws <Exception>(
                    () => subCommand.Execute(_path, _url, _identity, _force, blobSubstitute)
                    );

                Assert.Equal(_exception.Message, actualExc.Message);
            }
Beispiel #6
0
            public void FailsWithExistingProperty()
            {
                var obj = new SetBlob.AzmiArgumentsClass
                {
                    file     = _path,
                    blob     = _url,
                    force    = _force,
                    identity = _identity,
                    verbose  = false
                };
                var subCommand = new SetBlob();

                // it throws exception
                var actualExc = Assert.Throws <FileNotFoundException>(
                    () => subCommand.Execute(obj)
                    );

                Assert.NotEqual(_failMsg, actualExc.Message);
                Assert.Contains(_path, actualExc.Message);
            }