public CredentialsFixture() { string vfCredentialFile = Path.Combine(META.VersionInfo.MetaPath, "vf.txt"); if (File.Exists(vfCredentialFile) == false) { string userPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).FullName; if (Environment.OSVersion.Version.Major >= 6) { userPath = Directory.GetParent(userPath).FullName; } vfCredentialFile = Path.Combine(userPath, "vf.txt"); if (File.Exists(vfCredentialFile) == false) { throw new FileNotFoundException(vfCredentialFile); } } List <string> vfFileContent = File.ReadLines(vfCredentialFile).ToList(); if (vfFileContent.Count < 3) { string message = string.Format("{0} file must contain 3 lines vehicle forge url, username, pass.", vfCredentialFile); throw new ArgumentOutOfRangeException(message); } this.credentials = new ISIS.Web.Credentials(vfFileContent[0], vfFileContent[1], vfFileContent[2]); }
//[Fact] public void AuthenticationFailure() { ISIS.Web.Credentials credentialShouldFail = new ISIS.Web.Credentials(this.fixture.credentials); credentialShouldFail.Password = "******"; using (ISIS.VehicleForge.VFWebClient webClient = new ISIS.VehicleForge.VFWebClient(this.fixture.credentials.Url, credentialShouldFail)) { Assert.Throws <ISIS.VehicleForge.VFLoginException>(() => { webClient.SendGetRequest(""); }); } }