Example #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]);
                }
            });
        }
Example #2
0
        public void ServiceShouldReleaseLockedFolders()
        {
            var dsFactory = DefaultMocks.GetServiceFactory();

            using (var service1 = new DeployService(dsFactory.Object, null)) {
                using (var service2 = new DeployService(dsFactory.Object, null)) {
                    service2.OpenSession(_surveyName);
                    Assert.False(service1.OpenSession(_surveyName));
                }

                Assert.True(service1.OpenSession(_surveyName));
            }
        }
Example #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));
                }
            });
        }