public async void ValidateAsync_Invalid() { var path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Data", "test.license.xml"); var mockHandler = new MockHttpMessageHandler(); var client = mockHandler.ToHttpClient(); var service = new TestBaseLicenseService(client); service.Path = path; service.Failures = new[] { new GeneralValidationFailure { Code = "test", Message = "message", HowToResolve = "howtoresolve" } }; var result = await service.ValidateAsync(); Assert.False(result.Successful); Assert.Null(result.License); Assert.Null(result.Exception); Assert.Equal("test", result.Failures.ElementAt(0).Code); }
public async void ValidateAsync_Valid() { var path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Data", "test.license.xml"); var mockHandler = new MockHttpMessageHandler(); var client = mockHandler.ToHttpClient(); var service = new TestBaseLicenseService(client); service.Path = path; var result = await service.ValidateAsync(); Assert.True(result.Successful); Assert.NotNull(result.License); Assert.Null(result.Exception); Assert.False(result.Failures.Any()); }
public async void ValidateAsync_NoLicense() { var path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Data", "none.license.xml"); var mockHandler = new MockHttpMessageHandler(); var client = mockHandler.ToHttpClient(); var service = new TestBaseLicenseService(client); service.Path = path; var result = await service.ValidateAsync(); Assert.False(result.Successful); Assert.Null(result.License); Assert.Null(result.Exception); Assert.Equal("VAL.00", result.Failures.ElementAt(0).Code); }