static void Main(string[] args) { //load configuration data RemotingConfiguration.Configure(@"TestConsole.exe.config"); //(1). Test the data encryption/decryption using SAF.Cryptography // (a) test the symmatric cryptography string original = "This is a test!"; string encrypted = Encryption.Encrypt(original, "Profile1"); Console.WriteLine("Encrypted data is : " + encrypted); string decrypted = Decryption.Decrypt(encrypted, "Profile1"); Console.WriteLine("Decrypted data is : " + decrypted); // (b) test the asymmatric cryptography byte[] key; byte[] iv; byte[] signature; encrypted = Encryption.Encrypt(original, "Profile2", out key, out iv, out signature); Console.WriteLine("Encrypted data is : " + encrypted); decrypted = Decryption.Decrypt(encrypted, "Profile3", key, iv, signature); Console.WriteLine("Decrypted data is : " + decrypted); //(2). Test the secure remoting call via CryptoRemotingClient(Server)Sink. //Please refer to configuration file for profile information used for remoting calls. //creating the remoting object SampleBusiness sb = new SampleBusiness(); //invoking the secure remoting call. Console.WriteLine(sb.SayHelloWorld()); Console.WriteLine("press enter to exit"); Console.ReadLine(); }
public void ResolveAttribute() { Kernel.Map <IAnimal>().To <AnimalCat>(); Kernel.Map <Vehicle>().To <VehicleCar>(); var business = new SampleBusiness(); business.Animal.Should().NotBeNull("There is a class mapped"); business.Vehicle.Should().NotBeNull("There is a class mapped"); }
protected void Page_Load(object sender, EventArgs e) { DateTime dateTime = DateTime.Now; currentTime.Text = "Hora: " + dateTime.Hour + ":" + dateTime.Minute; if (Session[Utility.PROJECT_SELECTED] != null) { Project projectSelected = (Project)Session[Utility.PROJECT_SELECTED]; projectName.Text = "Projecto: " + projectSelected.Name; projectStatus.Text = "Estado: " + projectSelected.Status; projectLocation.Text = "Lugar de realización: " + projectSelected.Location; sampleHour.Text = "Hora: " + Session[Utility.SAMPLE_HOUR]; } sampleBusiness = new SampleBusiness(); }
public async Task GetTestByIdAsync_WhenGivenAValidId_ReturnsTheEquivalentTest() { // Arrange int testId = 1; mock.Setup(m => m.GetTestByIdAsync(testId)) .Returns(Task.Run(() => GetSampleTests().SingleOrDefault(t => t.Id == testId))); var sampleBusiness = new SampleBusiness(mock.Object); string expected = GetSampleTests().SingleOrDefault(t => t.Id == testId).Title; // Act string actual = await sampleBusiness.GetTestByIdAsync(testId); // Assert Assert.IsNotNull(actual); Assert.AreEqual(expected, actual); }
public async Task GetTestsAsync_ReturnsTheListOfAllTests() { // Arrange mock.Setup(m => m.GetTestsAsync()) .Returns(Task.Run(() => GetSampleTests())); var sampleBusiness = new SampleBusiness(mock.Object); var expected = GetSampleTests().Select(t => t.Title); // Act var actual = await sampleBusiness.GetTestsAsync(); // Assert Assert.IsNotNull(actual); Assert.AreEqual(expected.Count(), actual.Count()); for (int i = 0; i < expected.Count(); i++) { Assert.AreEqual(expected.ElementAt(i), actual.ElementAt(i)); } }
private void Form1_Load(object sender, EventArgs e) { timer1.Start(); dgvList.DataSource = SampleBusiness.GetAll(); }
private void timer1_Tick(object sender, EventArgs e) { dgvList.DataSource = SampleBusiness.GetAll(); }