Xunit.Assert.False(System.Nullable, string)

Here are the examples of the csharp api Xunit.Assert.False(System.Nullable, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1056 Examples 7

19 View Source File : DefaultTagHelperDescriptionFactoryTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryExtractSummary_NoEndSummary_ReturnsFalse()
        {
            // Arrange
            var doreplacedentation = @"
Prefixed invalid content


<summary>

Suffixed invalid content";

            // Act
            var result = DefaultTagHelperDescriptionFactory.TryExtractSummary(doreplacedentation, out var summary);

            // replacedert
            replacedert.False(result);
            replacedert.Null(summary);
        }

19 View Source File : FallbackConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveConfiguration_NoCoreCapability_ReturnsFalse()
        {
            // Arrange
            var projectCapabilities = Array.Empty<string>();
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());
            var context = new ProjectConfigurationProviderContext(projectCapabilities, projectInstance);
            var provider = new TestLegacyConfigurationProvider(MvcreplacedemblyVersion);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : DefaultProjectResolverTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolvePotentialProject_UnrelatedProject_ReturnsFalse()
        {
            // Arrange
            var doreplacedentFilePath = "C:/path/to/doreplacedent.cshtml";
            var unrelatedProject = Mock.Of<ProjectSnapshot>(p => p.FilePath == "C:/other/path/to/project.csproj");
            var projectResolver = CreateProjectResolver(() => new[] { unrelatedProject });

            // Act
            var result = projectResolver.TryResolvePotentialProject(doreplacedentFilePath, out var project);

            // replacedert
            replacedert.False(result);
            replacedert.Null(project);
        }

19 View Source File : MSBuildProjectManagerTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveConfigurationOutputPath_NoIntermediateOutputPath_ReturnsFalse()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());

            // Act
            var result = MSBuildProjectManager.TryResolveConfigurationOutputPath(projectInstance, out var path);

            // replacedert
            replacedert.False(result);
            replacedert.Null(path);
        }

19 View Source File : DefaultDocumentVersionCacheTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetDoreplacedentVersion_UntrackedDoreplacedentPath_ReturnsFalse()
        {
            // Arrange
            var doreplacedentVersionCache = new DefaultDoreplacedentVersionCache(Dispatcher);
            var doreplacedent = TestDoreplacedentSnapshot.Create("C:/file.cshtml");

            // Act
            var result = doreplacedentVersionCache.TryGetDoreplacedentVersion(doreplacedent, out var version);

            // replacedert
            replacedert.False(result);
            replacedert.Equal(-1, version);
        }

19 View Source File : DefaultDocumentResolverTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveDoreplacedent_AsksPotentialParentProjectForDoreplacedenreplacedNotTracking_ReturnsFalse()
        {
            // Arrange
            var doreplacedentFilePath = "C:\\path\\to\\doreplacedent.cshtml";
            var normalizedFilePath = "/C:/path/to/doreplacedent.cshtml";
            var filePathNormalizer = new FilePathNormalizer();
            var project = Mock.Of<ProjectSnapshot>(shim => shim.DoreplacedentFilePaths == new string[0]);
            var projectResolver = Mock.Of<ProjectResolver>(resolver => resolver.TryResolvePotentialProject(normalizedFilePath, out project) == true);
            var doreplacedentResolver = new DefaultDoreplacedentResolver(Dispatcher, projectResolver, filePathNormalizer);

            // Act
            var result = doreplacedentResolver.TryResolveDoreplacedent(doreplacedentFilePath, out var doreplacedent);

            // replacedert
            replacedert.False(result);
            replacedert.Null(doreplacedent);
        }

19 View Source File : ComponentRefreshTriggerTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void IsCompileItem_NotCompileItem_ReturnsFalse()
        {
            // Arrange
            var relativeFilePath = "/path/to/obj/Debug/file.razor.g.cs";
            var projectRootElement = ProjectRootElement.Create("/path/to/project.csproj");
            var projectInstance = new ProjectInstance(projectRootElement);
            var refreshTrigger = CreateTestComponentRefreshTrigger();

            // Act
            var result = refreshTrigger.IsCompileItem(relativeFilePath, projectInstance);

            // replacedert
            replacedert.False(result);
        }

19 View Source File : ResponseBodyTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Theory]
        [InlineData("Microsoft.Owin.Host.SystemWeb")]
        public async Task ResponseFlushedFromOtherFramwork_OnSendingHeadersStillFires(string serverName)
        {
            int port = RunWebServer(
                serverName,
                MockMvcFlushApp);

            var client = new HttpClient();
            var result = await client.GetAsync("http://localhost:" + port);

            IEnumerable<string> values;
            var found = result.Headers.TryGetValues("OSH", out values);

            // New in .NET 4.6, used for version detection
            MethodInfo PushPromiseMethod = typeof(HttpResponseBase).GetMethods().FirstOrDefault(info => info.Name.Equals("PushPromise"));
            if (PushPromiseMethod == null)
            {
                replacedert.False(found);
            }
            else
            {
                replacedert.True(found);
                replacedert.Equal("Fired", values.First());
            }
        }

19 View Source File : FallbackConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveConfiguration_NoMvcVersion_ReturnsFalse()
        {
            // Arrange
            var context = BuildContext("/some/path/to/some.dll", "/another/path/to/" + FallbackConfigurationProvider.MvcreplacedemblyFileName);
            var provider = new TestLegacyConfigurationProvider(mvcreplacedemblyVersion: null);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : SettingsDictionaryTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Theory]
        [MemberData(nameof(CustomSettings))]
        public void SetOrClearValue_SetsNonNullValue(string key, string value)
        {
            // Act
            _settings.SetOrClearValue(key, value);

            // replacedert
            if (value == null)
            {
                replacedert.False(_settings.ContainsKey(key));
            }
            else
            {
                replacedert.Equal(value, _settings[key]);
            }
        }

19 View Source File : LatestProjectConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetConfiguration_FailsIfNoLanguageVersion()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());
            projectInstance.SetProperty("RazorDefaultConfiguration", "Razor-13.37");

            // Act
            var result = LatestProjectConfigurationProvider.TryGetConfiguration(projectInstance, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : DefaultProjectResolverTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolvePotentialProject_NoProjects_ReturnsFalse()
        {
            // Arrange
            var doreplacedentFilePath = "C:/path/to/doreplacedent.cshtml";
            var projectResolver = CreateProjectResolver(() => new ProjectSnapshot[0]);

            // Act
            var result = projectResolver.TryResolvePotentialProject(doreplacedentFilePath, out var project);

            // replacedert
            replacedert.False(result);
            replacedert.Null(project);
        }

19 View Source File : WebHookHandlerContextExtensionsTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetData_HandlesNullContext()
        {
            // Arrange & Act
            var actual = WebHookHandlerContextExtensions.TryGetData<string>(null, out var output);

            // replacedert
            replacedert.False(actual);
        }

19 View Source File : DefaultTagHelperCompletionServiceTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void GetNearestAncestorTagInfo_MarkupElement()
        {
            // Arrange
            var codeDoreplacedent = CreateCodeDoreplacedent($"@addTagHelper *, Testreplacedembly{Environment.NewLine}<p><strong></strong></p>");
            var sourceSpan = new SourceSpan(33 + Environment.NewLine.Length, 0);
            var syntaxTree = codeDoreplacedent.GetSyntaxTree();
            var owner = syntaxTree.Root.LocateOwner(new SourceChange(sourceSpan, string.Empty));
            var element = owner.FirstAncestorOrSelf<MarkupElementSyntax>();

            // Act
            var (ancestorName, ancestorIsTagHelper) = DefaultTagHelperCompletionService.GetNearestAncestorTagInfo(element.Ancestors());

            // replacedert
            replacedert.Equal("p", ancestorName);
            replacedert.False(ancestorIsTagHelper);
        }

19 View Source File : SendFileResponseExtensionsTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void SendFileSupport()
        {
            IOwinResponse response = new OwinResponse();
            replacedert.False(response.SupportsSendFile());
            // response.Set("sendfile.SendAsync", new Object());
            // replacedert.False(response.SupportsSendFile()); // Get<type> throw for type mismatch.
            response.Set("sendfile.SendAsync", new Func<string, long, long?, CancellationToken, Task>((_, __, ___, ____) => Task.FromResult(0)));
            replacedert.True(response.SupportsSendFile());
        }

19 View Source File : BackgroundDocumentGeneratorTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void Queue_ProcessesNotifications_AndGoesBackToSleep()
        {
            // Arrange
            var projectManager = TestProjectSnapshotManager.Create(Dispatcher);
            projectManager.ProjectAdded(HostProject1);
            projectManager.ProjectAdded(HostProject2);
            projectManager.DoreplacedentAdded(HostProject1, Doreplacedents[0], null);
            projectManager.DoreplacedentAdded(HostProject1, Doreplacedents[1], null);

            var project = projectManager.GetLoadedProject(HostProject1.FilePath);

            var queue = new TestBackgroundDoreplacedentGenerator(Dispatcher, LoggerFactory)
            {
                Delay = TimeSpan.FromMilliseconds(1),
                BlockBackgroundWorkStart = new ManualResetEventSlim(initialState: false),
                NotifyBackgroundWorkStarting = new ManualResetEventSlim(initialState: false),
                BlockBackgroundWorkCompleting = new ManualResetEventSlim(initialState: false),
                NotifyBackgroundWorkCompleted = new ManualResetEventSlim(initialState: false),
            };

            // Act & replacedert
            queue.Enqueue(project.GetDoreplacedent(Doreplacedents[0].FilePath));

            replacedert.True(queue.IsScheduledOrRunning, "Queue should be scheduled during Enqueue");
            replacedert.True(queue.HasPendingNotifications, "Queue should have a notification created during Enqueue");

            // Allow the background work to proceed.
            queue.BlockBackgroundWorkStart.Set();
            queue.BlockBackgroundWorkCompleting.Set();

            queue.NotifyBackgroundWorkCompleted.Wait(TimeSpan.FromSeconds(3));

            replacedert.False(queue.IsScheduledOrRunning, "Queue should not have restarted");
            replacedert.False(queue.HasPendingNotifications, "Queue should have processed all notifications");
        }

19 View Source File : DefaultDocumentVersionCacheTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void ProjectSnapshotManager_Changed_DoreplacedentRemoved_EvictsDoreplacedent()
        {
            // Arrange
            var doreplacedentVersionCache = new DefaultDoreplacedentVersionCache(Dispatcher);
            var projectSnapshotManager = TestProjectSnapshotManager.Create(Dispatcher);
            projectSnapshotManager.AllowNotifyListeners = true;
            doreplacedentVersionCache.Initialize(projectSnapshotManager);
            var doreplacedent = TestDoreplacedentSnapshot.Create("C:/file.cshtml");
            doreplacedent.TryGetText(out var text);
            doreplacedent.TryGetTextVersion(out var textVersion);
            var textAndVersion = TextAndVersion.Create(text, textVersion);
            doreplacedentVersionCache.TrackDoreplacedentVersion(doreplacedent, 1337);
            projectSnapshotManager.ProjectAdded(doreplacedent.ProjectInternal.HostProject);
            projectSnapshotManager.DoreplacedentAdded(doreplacedent.ProjectInternal.HostProject, doreplacedent.State.HostDoreplacedent, TextLoader.From(textAndVersion));

            // Act - 1
            var result = doreplacedentVersionCache.TryGetDoreplacedentVersion(doreplacedent, out var version);

            // replacedert - 1
            replacedert.True(result);

            // Act - 2
            projectSnapshotManager.DoreplacedentRemoved(doreplacedent.ProjectInternal.HostProject, doreplacedent.State.HostDoreplacedent);
            result = doreplacedentVersionCache.TryGetDoreplacedentVersion(doreplacedent, out version);

            // replacedert - 2
            replacedert.False(result);
        }

19 View Source File : ComponentRefreshTriggerTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task IsComponentFile_UnknownDoreplacedent_ReturnsFalse()
        {
            // Arrange
            var projectManager = CreateProjectSnapshotManager();
            var refreshTrigger = CreateTestComponentRefreshTrigger();
            refreshTrigger.Initialize(projectManager);
            var hostProject = new OmniSharpHostProject("/path/to/project.csproj", RazorConfiguration.Default, "TestRootNamespace");
            await RunOnForegroundAsync(() => projectManager.ProjectAdded(hostProject));

            // Act
            var result = await RunOnForegroundAsync(() => refreshTrigger.IsComponentFile("file.razor", hostProject.FilePath));

            // replacedert
            replacedert.False(result);
        }

19 View Source File : OwinHttpListenerResponseTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task OwinHttpListenerResponse_Empty404Response_Success()
        {
            OwinHttpListener listener = CreateServer(env =>
            {
                env["owin.ResponseStatusCode"] = 404;
                return Task.FromResult(0);
            }, HttpServerAddress);

            using (listener)
            {
                var client = new HttpClient();
                HttpResponseMessage response = await client.GetAsync(HttpClientAddress);
                replacedert.Equal(HttpStatusCode.NotFound, response.StatusCode);
                replacedert.Equal("Not Found", response.ReasonPhrase);
                replacedert.Equal(2, response.Headers.Count());
                replacedert.False(response.Headers.TransferEncodingChunked.HasValue);
                replacedert.True(response.Headers.Date.HasValue);
                replacedert.Equal(1, response.Headers.Server.Count);
                replacedert.Equal(1, response.Content.Headers.Count()); // Content-Length
                replacedert.Equal(0, response.Content.Headers.ContentLength);
                replacedert.Equal(string.Empty, await response.Content.ReadreplacedtringAsync());
            }
        }

19 View Source File : FallbackConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveConfiguration_NoMvcReference_ReturnsFalse()
        {
            // Arrange
            var context = BuildContext("/some/path/to/some.dll");
            var provider = new TestLegacyConfigurationProvider(MvcreplacedemblyVersion);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : DefaultDocumentResolverTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveDoreplacedent_AsksMiscellaneousProjectForDoreplacedenreplacedIsNotTracking_ReturnsFalse()
        {
            // Arrange
            var doreplacedentFilePath = "C:\\path\\to\\doreplacedent.cshtml";
            var filePathNormalizer = new FilePathNormalizer();
            var project = Mock.Of<ProjectSnapshot>(shim => shim.DoreplacedentFilePaths == new string[0]);
            var projectResolver = Mock.Of<ProjectResolver>(resolver => resolver.GetMiscellaneousProject() == project);
            var doreplacedentResolver = new DefaultDoreplacedentResolver(Dispatcher, projectResolver, filePathNormalizer);

            // Act
            var result = doreplacedentResolver.TryResolveDoreplacedent(doreplacedentFilePath, out var doreplacedent);

            // replacedert
            replacedert.False(result);
            replacedert.Null(doreplacedent);
        }

19 View Source File : DefaultDocumentVersionCacheTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void ProjectSnapshotManager_Changed_DoreplacedentClosed_EvictsDoreplacedent()
        {
            // Arrange
            var doreplacedentVersionCache = new DefaultDoreplacedentVersionCache(Dispatcher);
            var projectSnapshotManager = TestProjectSnapshotManager.Create(Dispatcher);
            projectSnapshotManager.AllowNotifyListeners = true;
            doreplacedentVersionCache.Initialize(projectSnapshotManager);
            var doreplacedent = TestDoreplacedentSnapshot.Create("C:/file.cshtml");
            doreplacedent.TryGetText(out var text);
            doreplacedent.TryGetTextVersion(out var textVersion);
            var textAndVersion = TextAndVersion.Create(text, textVersion);
            doreplacedentVersionCache.TrackDoreplacedentVersion(doreplacedent, 1337);
            projectSnapshotManager.ProjectAdded(doreplacedent.ProjectInternal.HostProject);
            var textLoader = TextLoader.From(textAndVersion);
            projectSnapshotManager.DoreplacedentAdded(doreplacedent.ProjectInternal.HostProject, doreplacedent.State.HostDoreplacedent, textLoader);

            // Act - 1
            var result = doreplacedentVersionCache.TryGetDoreplacedentVersion(doreplacedent, out var version);

            // replacedert - 1
            replacedert.True(result);

            // Act - 2
            projectSnapshotManager.DoreplacedentClosed(doreplacedent.ProjectInternal.HostProject.FilePath, doreplacedent.State.HostDoreplacedent.FilePath, textLoader);
            result = doreplacedentVersionCache.TryGetDoreplacedentVersion(doreplacedent, out version);

            // replacedert - 2
            replacedert.False(result);
        }

19 View Source File : OwinHttpListenerResponseTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task OwinHttpListenerResponse_HeadRequestWithContentLength_Success()
        {
            OwinHttpListener listener = CreateServer(env =>
            {
                var responseHeaders = env.Get<IDictionary<string, string[]>>("owin.ResponseHeaders");
                responseHeaders["Content-Length"] = new string[] { "10" };
                return Task.FromResult(0);
            }, HttpServerAddress);

            using (listener)
            {
                var client = new HttpClient();
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Head, HttpClientAddress);
                HttpResponseMessage response = await client.SendAsync(request);
                replacedert.Equal(HttpStatusCode.OK, response.StatusCode);
                replacedert.Equal("OK", response.ReasonPhrase);
                replacedert.Equal(2, response.Headers.Count());
                replacedert.False(response.Headers.TransferEncodingChunked.HasValue);
                replacedert.True(response.Headers.Date.HasValue);
                replacedert.Equal(1, response.Headers.Server.Count);
                replacedert.Equal(1, response.Content.Headers.Count()); // Content-Length
                replacedert.Equal(10, response.Content.Headers.ContentLength);
                replacedert.Equal(string.Empty, await response.Content.ReadreplacedtringAsync());
            }
        }

19 View Source File : DefaultDocumentVersionCacheTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetDoreplacedentVersion_EvictedDoreplacedent_ReturnsFalse()
        {
            // Arrange
            var doreplacedentVersionCache = new DefaultDoreplacedentVersionCache(Dispatcher);
            var doreplacedent = TestDoreplacedentSnapshot.Create("C:/file.cshtml");
            var evictedDoreplacedent = TestDoreplacedentSnapshot.Create(doreplacedent.FilePath);
            doreplacedentVersionCache.TrackDoreplacedentVersion(doreplacedent, 1337);

            // Act
            var result = doreplacedentVersionCache.TryGetDoreplacedentVersion(evictedDoreplacedent, out var version);

            // replacedert
            replacedert.False(result);
            replacedert.Equal(-1, version);
        }

19 View Source File : CustomWebHookReceiverTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Theory]
        [InlineData("")]
        [InlineData("echo=")]
        [InlineData("invalid")]
        public async Task ReceiveAsync_ReturnsError_IfInvalidGetRequest(string query)
        {
            // Arrange
            Initialize(TestSecret);
            _getRequest.RequestUri = new Uri("http://localhost?" + query);

            // Act
            HttpResponseMessage actual = await ReceiverMock.Object.ReceiveAsync(TestId, RequestContext, _getRequest);

            // replacedert
            replacedert.False(actual.IsSuccessStatusCode);
            ReceiverMock.Protected()
                .Verify<Task<HttpResponseMessage>>("ExecuteWebHookAsync", Times.Never(), TestId, RequestContext, _getRequest, ItExpr.IsAny<IEnumerable<string>>(), ItExpr.IsAny<object>());
        }

19 View Source File : LatestProjectConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetConfiguration_FailsIfNoDefaultConfiguration()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());

            // Act
            var result = LatestProjectConfigurationProvider.TryGetConfiguration(projectInstance, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : RazorLanguageEndpointTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void GetCSharpProjectedPosition_NotMatchingAnyMapping()
        {
            // Arrange
            var codeDoc = CreateCodeDoreplacedentWithCSharpProjection(
                "test razor source",
                "test C# source",
                new[] { new SourceMapping(new SourceSpan(2, 100), new SourceSpan(0, 100)) });

            // Act
            var result = RazorLanguageEndpoint.TryGetCSharpProjectedPosition(
                codeDoc,
                1,
                out var projectedPosition,
                out var projectedPositionIndex);

            // replacedert
            replacedert.False(result);
            replacedert.Equal(default, projectedPosition);
            replacedert.Equal(default, projectedPositionIndex);
        }

19 View Source File : InstagramWebHookReceiverTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Theory]
        [InlineData("")]
        [InlineData("hub.challenge=")]
        [InlineData("invalid")]
        public async Task ReceiveAsync_ReturnsError_IfInvalidGetRequest(string query)
        {
            // Arrange
            Initialize(TestSecret);
            _getRequest.RequestUri = new Uri("https://localhost?" + query);

            // Act
            HttpResponseMessage actual = await ReceiverMock.Object.ReceiveAsync(TestId, RequestContext, _getRequest);

            // replacedert
            replacedert.False(actual.IsSuccessStatusCode);
            ReceiverMock.Protected()
                .Verify<Task<HttpResponseMessage>>("ExecuteWebHookAsync", Times.Never(), TestId, RequestContext, _getRequest, ItExpr.IsAny<IEnumerable<string>>(), ItExpr.IsAny<object>());
        }

19 View Source File : LatestProjectConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetConfiguration_FailsIfNoConfigurationItems()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());
            projectInstance.SetProperty("RazorDefaultConfiguration", "Razor-13.37");
            projectInstance.SetProperty("RazorLangVersion", "1.0");

            // Act
            var result = LatestProjectConfigurationProvider.TryGetConfiguration(projectInstance, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : HostPropertyTests.cs
License : Apache License 2.0
Project Creator : aspnet

public void RuntimePropertiesInspection(IAppBuilder app)
        {
            app.Run(context =>
            {
                replacedert.NotNull(context);

                var ct = context.Get<CancellationToken>("host.OnAppDisposing");
                replacedert.True(ct.CanBeCanceled);
                replacedert.False(ct.IsCancellationRequested);

                var appName = context.Get<string>("host.AppName");
                replacedert.NotNull(appName);

                var trace = context.Get<TextWriter>("host.TraceOutput");
                replacedert.NotNull(trace);

                return Task.FromResult(0);
            });
        }

19 View Source File : FilePathNormalizerTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void FilePathsEquivalent_NotEqualPaths_ReturnsFalse()
        {
            // Arrange
            var filePathNormalizer = new FilePathNormalizer();
            var filePath1 = "path/to/doreplacedent.cshtml";
            var filePath2 = "path\\to\\different\\doreplacedent.cshtml";

            // Act
            var result = filePathNormalizer.FilePathsEquivalent(filePath1, filePath2);

            // replacedert
            replacedert.False(result);
        }

19 View Source File : BackgroundDocumentGeneratorTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void Queue_ProcessesNotifications_AndRestarts()
        {
            // Arrange
            var projectManager = TestProjectSnapshotManager.Create(Dispatcher);
            projectManager.ProjectAdded(HostProject1);
            projectManager.ProjectAdded(HostProject2);
            projectManager.DoreplacedentAdded(HostProject1, Doreplacedents[0], null);
            projectManager.DoreplacedentAdded(HostProject1, Doreplacedents[1], null);

            var project = projectManager.GetLoadedProject(HostProject1.FilePath);

            var queue = new TestBackgroundDoreplacedentGenerator(Dispatcher, LoggerFactory)
            {
                Delay = TimeSpan.FromMilliseconds(1),
                BlockBackgroundWorkStart = new ManualResetEventSlim(initialState: false),
                NotifyBackgroundWorkStarting = new ManualResetEventSlim(initialState: false),
                NotifyBackgroundCapturedWorkload = new ManualResetEventSlim(initialState: false),
                BlockBackgroundWorkCompleting = new ManualResetEventSlim(initialState: false),
                NotifyBackgroundWorkCompleted = new ManualResetEventSlim(initialState: false),
            };

            // Act & replacedert
            queue.Enqueue(project.GetDoreplacedent(Doreplacedents[0].FilePath));

            replacedert.True(queue.IsScheduledOrRunning, "Queue should be scheduled during Enqueue");
            replacedert.True(queue.HasPendingNotifications, "Queue should have a notification created during Enqueue");

            // Allow the background work to start.
            queue.BlockBackgroundWorkStart.Set();

            queue.NotifyBackgroundWorkStarting.Wait(TimeSpan.FromSeconds(1));
            replacedert.True(queue.IsScheduledOrRunning, "Worker should be processing now");

            queue.NotifyBackgroundCapturedWorkload.Wait(TimeSpan.FromSeconds(1));
            replacedert.False(queue.HasPendingNotifications, "Worker should have taken all notifications");

            queue.Enqueue(project.GetDoreplacedent(Doreplacedents[1].FilePath));
            replacedert.True(queue.HasPendingNotifications); // Now we should see the worker restart when it finishes.

            // Allow work to complete, which should restart the timer.
            queue.BlockBackgroundWorkCompleting.Set();

            queue.NotifyBackgroundWorkCompleted.Wait(TimeSpan.FromSeconds(3));
            queue.NotifyBackgroundWorkCompleted.Reset();

            // It should start running again right away.
            replacedert.True(queue.IsScheduledOrRunning, "Queue should be scheduled during Enqueue");
            replacedert.True(queue.HasPendingNotifications, "Queue should have a notification created during Enqueue");

            // Allow the background work to proceed.
            queue.BlockBackgroundWorkStart.Set();

            queue.BlockBackgroundWorkCompleting.Set();
            queue.NotifyBackgroundWorkCompleted.Wait(TimeSpan.FromSeconds(3));

            replacedert.False(queue.IsScheduledOrRunning, "Queue should not have restarted");
            replacedert.False(queue.HasPendingNotifications, "Queue should have processed all notifications");
        }

19 View Source File : DefaultTagHelperDescriptionFactoryTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryExtractSummary_NoStartSummary_ReturnsFalse()
        {
            // Arrange
            var doreplacedentation = @"
Prefixed invalid content


</summary>

Suffixed invalid content";

            // Act
            var result = DefaultTagHelperDescriptionFactory.TryExtractSummary(doreplacedentation, out var summary);

            // replacedert
            replacedert.False(result);
            replacedert.Null(summary);
        }

19 View Source File : OwinHttpListenerResponseTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task OwinHttpListenerResponse_Empty200Response_Success()
        {
            OwinHttpListener listener = CreateServer(call => Task.FromResult(0), HttpServerAddress);

            using (listener)
            {
                var client = new HttpClient();
                HttpResponseMessage response = await client.GetAsync(HttpClientAddress);
                replacedert.Equal(HttpStatusCode.OK, response.StatusCode);
                replacedert.Equal("OK", response.ReasonPhrase);
                replacedert.Equal(2, response.Headers.Count());
                replacedert.False(response.Headers.TransferEncodingChunked.HasValue);
                replacedert.True(response.Headers.Date.HasValue);
                replacedert.Equal(1, response.Headers.Server.Count);
                replacedert.Equal(1, response.Content.Headers.Count()); // Content-Length
                replacedert.Equal(0, response.Content.Headers.ContentLength);
                replacedert.Equal(string.Empty, await response.Content.ReadreplacedtringAsync());
            }
        }

19 View Source File : DefaultTagHelperDescriptionFactoryTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryCreateDescription_NoreplacedociatedTagHelperDescriptions_ReturnsFalse()
        {
            // Arrange
            var descriptionFactory = new DefaultTagHelperDescriptionFactory();
            var elementDescription = ElementDescriptionInfo.Default;

            // Act
            var result = descriptionFactory.TryCreateDescription(elementDescription, out var markdown);

            // replacedert
            replacedert.False(result);
            replacedert.Null(markdown);
        }

19 View Source File : DefaultDocumentVersionCacheTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetLatestVersionFromPath_UntrackedDoreplacedent_ReturnsFalse()
        {
            // Arrange
            var doreplacedentVersionCache = new DefaultDoreplacedentVersionCache(Dispatcher);

            // Act
            var result = doreplacedentVersionCache.TryGetLatestVersionFromPath("/C:/file.cshtml", out var version);

            // replacedert
            replacedert.False(result);
            replacedert.Equal(-1, version);
        }

19 View Source File : DefaultDocumentVersionCacheTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void MarkAsLatestVersion_UntrackedDoreplacedent_Noops()
        {
            // Arrange
            var doreplacedentVersionCache = new DefaultDoreplacedentVersionCache(Dispatcher);
            var doreplacedent = TestDoreplacedentSnapshot.Create("/C:/file.cshtml");
            doreplacedentVersionCache.TrackDoreplacedentVersion(doreplacedent, 123);
            var untrackedDoreplacedent = TestDoreplacedentSnapshot.Create("/C:/other.cshtml");

            // Act
            doreplacedentVersionCache.MarkAsLatestVersion(untrackedDoreplacedent);

            // replacedert
            replacedert.False(doreplacedentVersionCache.TryGetDoreplacedentVersion(untrackedDoreplacedent, out var version));
            replacedert.Equal(-1, version);
        }

19 View Source File : RequestBodyTests.cs
License : Apache License 2.0
Project Creator : aspnet

public void DisableRequestBufferingApp(IAppBuilder app)
        {
            app.Run(context =>
            {
                replacedert.True(context.Request.Body.CanSeek);
                var disableBuffering = context.Get<Action>("server.DisableRequestBuffering");
                replacedert.NotNull(disableBuffering);
                disableBuffering();
                replacedert.False(context.Request.Body.CanSeek);
                var reader = new StreamReader(context.Request.Body);
                string text = reader.ReadToEnd();
                replacedert.False(context.Request.Body.CanSeek);
                return context.Response.WriteAsync(text);
            });
        }

19 View Source File : ComponentRefreshTriggerTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task IsComponentFile_UnknownProject_ReturnsFalse()
        {
            // Arrange
            var projectManager = CreateProjectSnapshotManager();
            var refreshTrigger = CreateTestComponentRefreshTrigger();
            refreshTrigger.Initialize(projectManager);

            // Act
            var result = await RunOnForegroundAsync(() => refreshTrigger.IsComponentFile("file.razor", "/path/to/project.csproj"));

            // replacedert
            replacedert.False(result);
        }

19 View Source File : DefaultProjectResolverTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolvePotentialProject_OnlyMiscellaneousProject_ReturnsFalse()
        {
            // Arrange
            var doreplacedentFilePath = "C:/path/to/doreplacedent.cshtml";
            DefaultProjectResolver projectResolver = null;
            var miscProject = new Mock<ProjectSnapshot>();
            miscProject.Setup(p => p.FilePath)
                .Returns(() => projectResolver._miscellaneousHostProject.FilePath);
            projectResolver = CreateProjectResolver(() => new[] { miscProject.Object });

            // Act
            var result = projectResolver.TryResolvePotentialProject(doreplacedentFilePath, out var project);

            // replacedert
            replacedert.False(result);
            replacedert.Null(project);
        }

19 View Source File : ComponentRefreshTriggerTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task IsComponentFile_NonComponent_ReturnsFalse()
        {
            // Arrange
            var projectManager = CreateProjectSnapshotManager();
            var refreshTrigger = CreateTestComponentRefreshTrigger();
            refreshTrigger.Initialize(projectManager);
            var hostProject = new OmniSharpHostProject("/path/to/project.csproj", RazorConfiguration.Default, "TestRootNamespace");
            var hostDoreplacedent = new OmniSharpHostDoreplacedent("file.cshtml", "file.cshtml", FileKinds.Legacy);
            await RunOnForegroundAsync(() =>
            {
                projectManager.ProjectAdded(hostProject);
                projectManager.DoreplacedentAdded(hostProject, hostDoreplacedent);
            });

            // Act
            var result = await RunOnForegroundAsync(() => refreshTrigger.IsComponentFile(hostDoreplacedent.FilePath, hostProject.FilePath));

            // replacedert
            replacedert.False(result);
        }

19 View Source File : AzureAdB2COpenIDConnectEventHandlersTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public async Task OnRedirectToIdenreplacedyProviderHandler_UpdatesRequestForOtherPolicies()
        {
            // Arrange

            var handlers = new AzureADB2COpenIDConnectEventHandlers(
                AzureADB2CDefaults.AuthenticationScheme,
                new AzureADB2COptions() { SignUpSignInPolicyId = "B2C_1_SiUpIn" });

            var authenticationProperties = new AuthenticationProperties(new Dictionary<string, string>
            {
                [AzureADB2CDefaults.PolicyKey] = "B2C_1_EP"
            });
            var redirectContext = new RedirectContext(
                new DefaultHttpContext(),
                new AuthenticationScheme(AzureADB2CDefaults.AuthenticationScheme, "", typeof(OpenIdConnectHandler)),
                new OpenIdConnectOptions(),
                authenticationProperties)
            {
                ProtocolMessage = new OpenIdConnectMessage
                {
                    Scope = OpenIdConnectScope.OpenId,
                    ResponseType = OpenIdConnectResponseType.Code,
                    IssuerAddress = "https://login.microsoftonline.com/tfp/domain.onmicrosoft.com/B2C_1_EP/v2.0"
                }
            };

            // Act
            await handlers.OnRedirectToIdenreplacedyProvider(redirectContext);

            // replacedert
            replacedert.Equal(OpenIdConnectScope.OpenIdProfile, redirectContext.ProtocolMessage.Scope);
            replacedert.Equal(OpenIdConnectResponseType.IdToken, redirectContext.ProtocolMessage.ResponseType);
            replacedert.Equal(
                "https://login.microsoftonline.com/tfp/domain.onmicrosoft.com/b2c_1_ep/v2.0",
                redirectContext.ProtocolMessage.IssuerAddress);
            replacedert.False(authenticationProperties.Items.ContainsKey(AzureADB2CDefaults.PolicyKey));
        }

19 View Source File : FallbackConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryResolveConfiguration_RazorConfigurationCapability_ReturnsFalse()
        {
            // Arrange
            var projectCapabilities = new[] 
            {
                CoreProjectConfigurationProvider.DotNetCoreRazorCapability,
                CoreProjectConfigurationProvider.DotNetCoreRazorConfigurationCapability
            };
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());
            var context = new ProjectConfigurationProviderContext(projectCapabilities, projectInstance);
            var provider = new TestLegacyConfigurationProvider(MvcreplacedemblyVersion);

            // Act
            var result = provider.TryResolveConfiguration(context, out var configuration);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configuration);
        }

19 View Source File : RazorCompletionEndpointTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void CanResolve_NonTagHelperCompletion_ReturnsFalse()
        {
            // Arrange
            var completionEndpoint = new RazorCompletionEndpoint(Dispatcher, EmptyDoreplacedentResolver, CompletionFactsService, TagHelperCompletionService, TagHelperDescriptionFactory, LoggerFactory);
            var completionItem = new CompletionItem();

            // Act
            var result = completionEndpoint.CanResolve(completionItem);

            // replacedert
            replacedert.False(result);
        }

19 View Source File : ResponseHeadersTests.cs
License : Apache License 2.0
Project Creator : aspnet

public void SetCustomResponseHeader(IAppBuilder app)
        {
            app.Run(context =>
            {
                replacedert.False(context.Response.Headers.ContainsKey("custom"));
                context.Response.Headers["custom"] = "custom value";
                replacedert.True(context.Response.Headers.ContainsKey("custom"));
                context.Response.StatusCode = ExpectedStatusCode;
                return Task.FromResult(0);
            });
        }

19 View Source File : GridifyMapperShould.cs
License : MIT License
Project Creator : alirezanet

[Fact]
      public void CaseSensitivity()
      {
         var sut = new GridifyMapper<TestClreplaced>(q => q.CaseSensitive = true);
         sut.AddMap("id", q => q.Id);

         replacedert.True(sut.HasMap("id"));
         replacedert.False(sut.HasMap("ID"));
      }

19 View Source File : CookiesAuthDefault.cs
License : Apache License 2.0
Project Creator : aspnet

[Theory, Trait("FunctionalTests", "Security")]
        [InlineData(HostType.IIS)]
        [InlineData(HostType.HttpListener)]
        public void Security_CookiesAuthDefaults(HostType hostType)
        {
            using (ApplicationDeployer deployer = new ApplicationDeployer())
            {
                string applicationUrl = deployer.Deploy(hostType, CookieAuthDefaultsConfiguration);
                string homePath = applicationUrl + "Auth/Home";
                string logoutPath = applicationUrl + string.Format("Auth/Logout?ReturnUrl={0}", new Uri(homePath).AbsolutePath);

                var handler = new HttpClientHandler();
                var httpClient = new HttpClient(handler);

                // Unauthenticated request
                var response = httpClient.GetAsync(applicationUrl).Result;
                CookiesCommon.IsRedirectedToCookiesLogin(response.RequestMessage.RequestUri, applicationUrl, "Unauthenticated requests not automatically redirected to login page");

                // Invalid credentials test
                for (int retryCount = 0; retryCount < 2; retryCount++)
                {
                    response = httpClient.PostAsync(response.RequestMessage.RequestUri, GetInValidCookieCredentials()).Result;
                    CookiesCommon.IsRedirectedToCookiesLogin(response.RequestMessage.RequestUri, applicationUrl, "Invalid credentials - not automatically redirecting to login page with proper ReturnUrl");
                }

                // Valid credentials
                response = httpClient.PostAsync(response.RequestMessage.RequestUri, GetValidCookieCredentials()).Result;
                replacedert.Equal<string>(applicationUrl, response.RequestMessage.RequestUri.AbsoluteUri);

                //Verify cookie sent
                replacedert.False(handler.CookieContainer.Count != 1 ||
                            handler.CookieContainer.GetCookies(new Uri(applicationUrl))[0].Name != "KATANACOOKIE",
                            string.Format("Forms auth cookie with expected name '{0}' not received automatically after successful login", "KATANACOOKIE"));

                //Retry multiple times with valid cookie to test sliding expiration
                for (int retryCount = 0; retryCount < 3; retryCount++)
                {
                    Thread.Sleep(2 * 1000);
                    response = httpClient.GetAsync(applicationUrl).Result;
                    response.EnsureSuccessStatusCode();
                    replacedert.Equal<string>("ProtectedResource", response.Content.ReadreplacedtringAsync().Result);
                    replacedert.Equal<string>(applicationUrl, response.RequestMessage.RequestUri.AbsoluteUri);
                }

                //Expire the cookie & verify if request is redirected to login page again
                Thread.Sleep(3 * 1000);
                response = httpClient.GetAsync(applicationUrl).Result;
                response.EnsureSuccessStatusCode();
                CookiesCommon.IsRedirectedToCookiesLogin(response.RequestMessage.RequestUri, applicationUrl, "Request not automatically redirected to login page after cookie expiry");

                //Reauthenticate with valid cookie & verify if protected resource is accessible again
                response = httpClient.PostAsync(response.RequestMessage.RequestUri, GetValidCookieCredentials()).Result;
                replacedert.Equal<string>("ProtectedResource", response.Content.ReadreplacedtringAsync().Result);
                replacedert.Equal<string>(applicationUrl, response.RequestMessage.RequestUri.AbsoluteUri);

                //Make one successful call
                response = httpClient.GetAsync(applicationUrl).Result;

                //Now corrupt the cookie to see if this gets redirected to login page
                string backUpCookieValue = handler.CookieContainer.GetCookies(new Uri(applicationUrl))[0].Value;
                handler.CookieContainer.GetCookies(new Uri(applicationUrl))[0].Value = "invalid cookie value";
                response = httpClient.GetAsync(applicationUrl).Result;

                CookiesCommon.IsRedirectedToCookiesLogin(response.RequestMessage.RequestUri, applicationUrl, "Request not automatically redirected to login page after cookie expiry");

                //put back the valid cookie & verify protected resource is accessible again
                handler.CookieContainer.GetCookies(new Uri(applicationUrl))[0].Value = backUpCookieValue;
                response = httpClient.GetAsync(applicationUrl).Result;
                replacedert.Equal<string>("ProtectedResource", response.Content.ReadreplacedtringAsync().Result);
                replacedert.Equal<string>(applicationUrl, response.RequestMessage.RequestUri.AbsoluteUri);

                //Logout the client
                response = httpClient.GetAsync(logoutPath).Result;
                replacedert.True(handler.CookieContainer.Count == 0, "Cookie is not cleared on logout");
                replacedert.Equal<string>("Welcome Home", response.Content.ReadreplacedtringAsync().Result);

                //Try accessing protected resource again. It should get redirected to login page
                response = httpClient.GetAsync(applicationUrl).Result;
                CookiesCommon.IsRedirectedToCookiesLogin(response.RequestMessage.RequestUri, applicationUrl, "Request not automatically redirected to login page after cookie expiry");
            }
        }

19 View Source File : HostPropertyTests.cs
License : Apache License 2.0
Project Creator : aspnet

public void StartupPropertiesInspection(IAppBuilder app)
        {
            IDictionary<string, object> properties = app.Properties;
            replacedert.NotNull(properties);

            var ct = properties.Get<CancellationToken>("host.OnAppDisposing");
            replacedert.True(ct.CanBeCanceled);
            replacedert.False(ct.IsCancellationRequested);

            var appName = properties.Get<string>("host.AppName");
            replacedert.NotNull(appName);

            var trace = properties.Get<TextWriter>("host.TraceOutput");
            replacedert.NotNull(trace);

            app.Run(context => { return Task.FromResult(0); });
        }

19 View Source File : DropboxWebHookReceiverTests.cs
License : Apache License 2.0
Project Creator : aspnet

[Theory]
        [InlineData("")]
        [InlineData("challenge=")]
        [InlineData("invalid")]
        public async Task ReceiveAsync_ReturnsError_IfInvalidGetRequest(string query)
        {
            // Arrange
            Initialize(TestSecret);
            _getRequest.RequestUri = new Uri("http://localhost?" + query);

            // Act
            HttpResponseMessage actual = await ReceiverMock.Object.ReceiveAsync(TestId, RequestContext, _getRequest);

            // replacedert
            replacedert.False(actual.IsSuccessStatusCode);
            ReceiverMock.Protected()
                .Verify<Task<HttpResponseMessage>>("ExecuteWebHookAsync", Times.Never(), TestId, RequestContext, _getRequest, ItExpr.IsAny<IEnumerable<string>>(), ItExpr.IsAny<object>());
        }

19 View Source File : LatestProjectConfigurationProviderTest.cs
License : Apache License 2.0
Project Creator : aspnet

[Fact]
        public void TryGetConfigurationItem_FailsNoMatchingRazorConfigurationItems()
        {
            // Arrange
            var projectInstance = new ProjectInstance(ProjectRootElement.Create());
            projectInstance.AddItem("RazorConfiguration", "Razor-10.0");

            // Act
            var result = LatestProjectConfigurationProvider.TryGetConfigurationItem("Razor-13.37", projectInstance.Items, out var configurationItem);

            // replacedert
            replacedert.False(result);
            replacedert.Null(configurationItem);
        }

See More Examples