Ejemplo n.º 1
0
        public void CallDeployWithoutFilesWillFail()
        {
            var dsFactory = DefaultMocks.GetServiceFactory();
            var cFactory = DefaultMocks.GetConfFactory();

            Assert.Throws<InvalidOperationException>(() => {
                using (var service = new DeployService(dsFactory.Object, cFactory.Object)) {
                    service.OpenSession(_surveyName);
                    service.Deploy(GetDeployContext(), new byte[0]);
                }
            });
        }
Ejemplo n.º 2
0
        public void ServiceShouldDemandOpenSessionMethod()
        {
            var dsFacory = DefaultMocks.GetServiceFactory();

            var service = new DeployService(dsFacory.Object, null);

            Assert.Throws<AuthenticationException>(() => service.Deploy(GetDeployContext(DeployMode.Install), new byte[10]));
        }
Ejemplo n.º 3
0
        public void IfFilesTransferWasCorruptedDeployThrows()
        {
            var dsFactory = DefaultMocks.GetServiceFactory();
            var cFactory = DefaultMocks.GetConfFactory();

            Assert.Throws<ArgumentException>(() => {
                using (var service = new DeployService(dsFactory.Object, cFactory.Object)) {
                    service.OpenSession(_surveyName);

                    foreach (var chunk in _files.Chunks)
                        service.SendFilesChunk(chunk);

                    var spoiledFiles = new byte[_files.Bytes.Length];
                    Array.Copy(_files.Bytes, spoiledFiles, _files.Bytes.Length);
                    spoiledFiles[100] = 0;

                    service.Deploy(GetDeployContext(), MD5.Create().ComputeHash(spoiledFiles));
                }
            });
        }